Skip to content

LOWTRAN atmospheric absorption extinction, scatter and irradiance model--in Python and Matlab

License

Notifications You must be signed in to change notification settings

HeYanKee/lowtran

 
 

Repository files navigation

Lowtran in Python

Zenodo DOI Language grade: Python Actions Status PyPi version PyPi Download stats

LOWTRAN7 atmospheric absorption extinction model. Updated to be platform independent and easily accessible from Python and Matlab.

The main LOWTRAN program is accessible from Python by using direct memory transfers instead of the cumbersome and error-prone process of writing/reading text files. xarray.Dataset high-performance, simple N-D array data is passed out, with appropriate metadata.

Gallery

See below for how to make these examples.

Lowtran7 absorption

Install

Lowtran requires a Fortran compiler and CMake. We use f2py (part of numpy) to seamlessly use Fortran libraries from Python by special compilation of the Fortran library with auto-generated shim code.

  1. If a Fortran compiler is not already installed, install Gfortran:

    • Linux: apt install gfortran
    • Mac: brew install gcc
    • Windows: use any one of Windows Subsystem for Linux, MSYS2, MinGW to get Gfortran or use Intel oneAPI.

Note: Cygwin is essentially obsolete due to Windows Subsystem for Linux. Cygwin is broken for Numpy and Gfortran and general.

  1. Install Python Lowtran code

    pip install -e .

Examples

In these examples, you can write to HDF5 with the -o option.

We present Python examples of:

  • ground-to-space transmittance: TransmittanceGround2Space.py

    Lowtran Transmission

  • sun-to-observer scattered radiance (why the sky is blue): ScatterRadiance.py

    Lowtran Scatter Radiance

  • sun-to-observer irradiance: SolarIrradiance.py

    Lowtran Solar Irradiance

  • observer-to-observer solar single-scattering solar radiance (up-going) with custom Pressure, Temperature and partial pressure for 12 species: UserDataHorizontalRadiance.py Lowtran Solar Irradiance

  • observer-to-observer transmittance with custom Pressure, Temperature and partial pressure for 12 species: UserDataHorizontalTransmittance.py

  • observer-to-observer transmittance: HorizontalTransmittance.py

    Lowtran Horizontal Path transmittance

Matlab

Matlab users can seamlessly access Python modules, as demonstrated in RunLowtran.m.

Here's what's you'll need:

  1. Setup Python ↔ Matlab interface.

  2. Install Lowtran in Python as at the top of this Readme.

  3. From Matlab, verify everything is working by:

    runtests('lowtran')

Notes

LOWTRAN7 User manual Refer to this to understand what parameters are set to default. Currently I don't have any aerosols enabled for example, though it's possible to add them into the code.

Right now a lot of configuration features aren't implemented, please request those you want.

Reference

  • Original 1994 Lowtran7 Code
  • LOWFIL program in reference/lowtran7.10.f was not connected as we had previously implemented a filter function directly in Python.
  • LOWSCAN spectral sampling (scanning) program in reference/lowtran7.13.f was not connected as we had no need for coarser spectral resolution.

About

LOWTRAN atmospheric absorption extinction, scatter and irradiance model--in Python and Matlab

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 58.5%
  • Fortran 22.9%
  • CMake 9.0%
  • AGS Script 7.3%
  • MATLAB 2.2%
  • M 0.1%