pymodtran is a small Python library that automates the generation of atmospheric thermal components using MODTRAN 5.
It produces the three key outputs used in thermal remote sensing:
- Transmittance T(λ)
- Upwelling radiance U(λ)
- Downwelling radiance D(λ)
The user only provides:
- Surface temperature (
Tsurf) - Water vapor scale (
h2o_scale) - Ozone scale (
o3_scale)
- Create any folder on your computer (e.g.
test_modtran/): - Inside that folder, install the library directly from GitHub:
pip install git+https://github.com/Jeferson0809/modtranpy.git- In the same folder, create a Python file (for example test_tud.py):
from modtran_tud import (
run_TUD, set_modtran_dir,
save_tud_npz, load_tud_npz,
plot_TUD)
# Point to your local MODTRAN 5 installation
set_modtran_dir(r"C:\PcModWin5\Bin")
# Run a simulation
res = run_TUD(
Tsurf=300.0,
h2o_scale=1.0,
o3_scale=1.0,
h1=6.0,
h2=0.0015,
sensor_center=0.0,
sensor_width=10.0 #cm-1
)
# Save the result as .npz
save_tud_npz(res, "T300_H1p0_O1p0.npz")
# Load the saved result (can be on another machine or in Colab)
res2 = load_tud_npz("T300_H1p0_O1p0.npz")
# Plot the T, U, D curves from the loaded file
plot_TUD(res2)
- Run the script
python test_tud.py⚙️ Requirements
● A local licensed installation of MODTRAN 5
● The directory passed to set_modtran_dir() must contain the MODTRAN executable
Example: C:\PcModWin5\Bin\