Fully-featured Python interface for rapid radiative transfer model (RRTM)
Project description
parserrtm
A high-level interface for running the Rapid Radiative Transfer Model (RRTM) in Python, both longwave (RRTM_LW) and shortwave (RRTM_SW) versions. A high-level interface helps because the Fortran text file inputs are unreadable by humans and have a complicated structure. With this library, all you interact with are named input parameters and calculation results. The strength of parserrtm is that it supports (almost) every possible configuration of both models (reach out if a configuration you need isn't supported!).
With parserrtm, you can simply take an existing example input file and modify the field of interest to you by name. The library takes care of underlying file I/O and just gives you a dataset with the results of your calculation.
installing parserrtm
Two components are needed: (1) this Python library and (2) executables for the RRTM Fortran codes. The Python library is easy to install and I have a compilation guide for getting the RRTM executables from rrtm_lw/ and rrtm_sw/ in this repository. If you are running anything other than Red Hat Enterprise Linux 8.10, you will probably need to compile RRTM.
I've only ever successfully compiled RRTM on linux with the PGI/NVIDIA compiler, so if you're on another OS I'd reccomend using a virtual machine (like lima for macOS).
from pypi
git clone https://github.com/bertrandclim/parserrtm.git
pip install parserrtm
from git repo
git clone https://github.com/bertrandclim/parserrtm.git
cd parserrtm
python3 -m build
pip install dist/parserrtm-0.0.1.tar.gz
after installing
First, you should benchmark your RRTM executable. Open /tests/run_stock_examples.ipynb in Jupyterlab (or similar) and hit notebook -> run all cells. This will run a series of example cases for RRTM_LW and RRTM_SW and validate the output.
overview
parserrtm offers three high-level classes for running this radiative transfer model: InputLW, InputSW, and Runner.
The InputLW and InputSW classes expose RRTM parameter fields as attributes you can assign to or declare. For explanations of these parameter fields, see rrtm_lw/rrtm_instructions and rrtm_sw/rrtm_sw_instructions. Each instance of InputLW or InputSW holds all the data for a single RRTM run.
You can initialize an InputLW or InputSW object from existing RRTM input text files or a dictionary. Once you have an InputLW or InputSW object that sets up the kind of calculation you want, you can simply modify the attributes of interest and rerun the calculations.
Calculations are handled by the Runner class. Runner takes a series of input objects, runs RRTM (in parallel) for each input, and loads the output back into Python.
Coming soon: some usage example tutorials and documentation pages. For now, the docstrings of Runner, Input, InputSW, and InputLW should be a good starting point.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file parserrtm-0.1.1.tar.gz.
File metadata
- Download URL: parserrtm-0.1.1.tar.gz
- Upload date:
- Size: 30.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
720a91fcb202b43d1d91911ce335d8373f1d1e5409b41c60f2be310d69de33e5
|
|
| MD5 |
d455a4baa8798435ed1e8001893deea9
|
|
| BLAKE2b-256 |
0e0e70f30078995eaf8a1ddfa15362d08c3724eeb50ab1150963405d5d63f369
|
File details
Details for the file parserrtm-0.1.1-py3-none-any.whl.
File metadata
- Download URL: parserrtm-0.1.1-py3-none-any.whl
- Upload date:
- Size: 33.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1504bfa2890d08085a77197923c726b9f80e665af8e48ebf4bf9b1aca32516e8
|
|
| MD5 |
f7fef8d1c9523562921360c4ddd7ee8a
|
|
| BLAKE2b-256 |
8813de7699de19d90948476ecaaf13ce17428c9611a23f822caca8b7091aa1eb
|