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/.

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.0.1.tar.gz (30.7 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.0.1-py3-none-any.whl (33.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for parserrtm-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ec0aab2613c2035d981f2c7c91f66f0589c45cec8b621197d26a8fc38804842d
MD5 98b737d2c6a444abb9587bc7436bf468
BLAKE2b-256 5d8df41c6fb7b2f51ac990f858ee210a8b0089a8796489935410c56727af5d44

See more details on using hashes here.

File details

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

File metadata

  • Download URL: parserrtm-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 33.5 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.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 00ffcd13ea96d591aee29f59ad724845f7b611c21e62d9365ba01e3b65013225
MD5 973dade5d385720c839e3a6338525f15
BLAKE2b-256 b1bc91454009c8adb18d5f43ea399545719222a56ef4c040340325479d60868c

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