Installation#

Install openMWR#

Use Python 3.11 or newer. Create a working project for site settings, datasets and retrievals:

mkdir my_project
cd my_project

Create a virtual environment and install openMWR from PyPI with either pip or uv.

PyTorch is installed automatically with openMWR. For CPU-only use or a specific GPU, install torch in the activated environment before installing openMWR. Follow the PyTorch installation selector. With uv, use uv pip instead of pip or pip3.

With pip#

python3 -m venv .venv
source .venv/bin/activate
python -m pip install openMWR

With uv#

With uv installed:

uv venv .venv
source .venv/bin/activate
uv pip install openMWR

Both install the openMWR command and Python package, including its torchMWRT dependency. A Git checkout is not required. Check the installation:

openMWR --help

Activate this environment again when opening a new shell. python -m openMWR is equivalent to openMWR. The commands work with either installation method. To work from another directory, pass --project-dir /path/to/my_project to a command. openMWR COMMAND --help lists its options and short aliases.

For running notebooks or displaying plots inline, install the notebook extra:

python -m pip install 'openMWR[notebook]'

With uv, use uv pip install 'openMWR[notebook]'.

From a Git checkout#

For package development, clone the repository beside the working project. Run from my_project/ with its environment activated:

git clone https://github.com/DSchlebruegge/openMWR.git ../openMWR
python -m pip install --editable ../openMWR/torchMWRT --editable ../openMWR

With uv, use uv pip install --editable ../openMWR/torchMWRT --editable ../openMWR. Both packages use the checkout directly, so package code edits take effect without reinstalling. Project data and configuration stay in my_project/.

Install torchMWRT alone#

For microwave radiative-transfer calculations without the retrieval workflows, install torchMWRT in an activated environment:

python -m pip install torchMWRT

With uv, use uv pip install torchMWRT. See the torchMWRT example for Python usage. This installation does not require openMWR or libRadtran.

Install libRadtran#

libRadtran is a required dependency for the forward calculation of the infrared sensor measurements on a HATPRO MWR.

libRadtran is GPL-licensed third-party software. This project does not bundle or distribute libRadtran. Users install libRadtran separately. See: https://www.libradtran.org/doku.php?id=download The commands below install it inside the working project created above:

Download libRadtran 2.0.6:

libradtran_version=2.0.6
wget https://www.libradtran.org/download/libRadtran-${libradtran_version}.tar.gz

Unpack the distribution:

gzip -d libRadtran-${libradtran_version}.tar.gz
tar -xvf libRadtran-${libradtran_version}.tar
rm libRadtran-${libradtran_version}.tar

Compile the distribution:

cd libRadtran-${libradtran_version}
./configure
make

Test the program:

make check

From the libRadtran directory, download the REPTRAN absorption data:

wget 'https://www.libradtran.org/lib/exe/fetch.php?media=download:reptran_2024_all.tar.gz' -O reptran_2024_all.tar.gz

gzip -d reptran_2024_all.tar.gz
tar -xvf reptran_2024_all.tar
rm reptran_2024_all.tar

openMWR first looks for a libRadtran-* directory in the current working directory, then for uvspec on PATH. For an installation elsewhere, add its bin directory to PATH in the shell configuration (e.g. ~/.bashrc or ~/.zshrc):

export PATH="$HOME/opt/libRadtran-2.0.6/bin:$PATH"

The data directory is found automatically at data/ or share/libRadtran/data/ under the installation prefix. For data stored elsewhere, set LIBRADTRAN_DATA_FILES to that directory.

Return to the working project:

cd ..

Continue with Create a Retrieval.