Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parserrtm-0.1.tar.gz (30.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parserrtm-0.1-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

Details for the file parserrtm-0.1.tar.gz.

File metadata

  • Download URL: parserrtm-0.1.tar.gz
  • Upload date:
  • Size: 30.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for parserrtm-0.1.tar.gz
Algorithm Hash digest
SHA256 2e789b31bcd48b1712c7e3f4153feed38b74341d0b28fb0a3b23f032b064b9e0
MD5 a466292825fe3c3b8381f0a3aa122e9f
BLAKE2b-256 07a441ec9eb422549ded80616da63e9d9811f7a9d489b6d77431adb5a2bccf90

See more details on using hashes here.

File details

Details for the file parserrtm-0.1-py3-none-any.whl.

File metadata

  • Download URL: parserrtm-0.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.12.4

File hashes

Hashes for parserrtm-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a55e371971aa3f36299f8941557df5a075d078b297af7c9ceab4d662cc472cfc
MD5 9845703614b47d32b948a0af6f03fdce
BLAKE2b-256 1624f10ed02674e228270d0d7e9b338b2833a11d2d1f7e9f8e7d61cf4163afc9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page