The FORTRAN GLobal airglOW (GLOW) Model in Python.
A Fortran compiler is REQUIRED.
Note: This version uses meson and ninja as the build system, does not rely on distutils,
and is compatible with Python ≥ 3.11.
This library also allows parallelization of model evaluation using the multiprocessing module.
Additionally, the GlowModel class exposes complete control over model evaluation, which is divided
into the following fundamental steps:
initialize: Set the altitude, energy grids and solar flux model (Hinteregger, EUVAC, custom).setup: Set the model up for evaluation, specifying time, location, and optionally geomagnetic parameters. If geomagnetic parameters are not specified, they are retrieved usinggeomagdata.precipitation(optional): Evaluate the energy and flux of precipitating electrons (Maxwellian or monoenergetic).atmosphere: Evaluate the neutral atmosphere (MSISE-00) and ionosphere (IRI-90).radtrans: Evaluate the GLOW radiative transfer model to calculate volume emission rates and ion composition.result: Retrieve the model output as a xarray.Dataset.
Note: Between the atmosphere and radtrans steps, the intermediate dataset can be accessed using the result method by passing copy=False. This returns a reference to the internal dataset. Modifying the dataset in place allows for modifying the atmosphere and ionosphere presented to the radtrans step.
A Fortran compiler is REQUIRED.
Ensure that you have the following development packages installed:
build-essential(forgcc,g++,make, etc.)gfortran(Fortran compiler)
Ensure that you have the Xcode Command Line Tools installed. You can install them by running:
xcode-select --installInstall homebrew if you haven't already, and then install gfortran:
brew install gfortranNote: For macOS Big Sur and above, you may need to add the following line to your environment script (~/.zshrc if using ZSH, or the relevant shell init script):
export LIBRARY_PATH="$LIBRARY_PATH:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"Then reopen the terminal. This fixes the issue where -lSystem fails for gfortran.
Important
Windows Path Length Limitation: glowpython2 and its dependencies (msis21py,
iri20py) compile Fortran code using Meson & pip, which can put temporary object
files with very long paths. Windows has a 260-character path limit by default.
You must set the TEMP and TMP environment variables to short paths before
installing, regardless of which method you use to install gfortran.
Conda (Recommended):
conda install -c conda-forge gfortran
mkdir C:\T
set TEMP=C:\T
set TMP=C:\TOther Options:
MSYS2
- Install MSYS2 (defaults to
C:\msys64) - Launch the MSYS2 terminal from the start menu
- Update MSYS2:
pacman -Syu # Restart the terminal when prompted pacman -Su # Update packages
- Install the GNU Compiler Collection:
pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-gcc-fortran
- Add MSYS2 to PATH:
- Search for "env" in the Start menu
- Select "Edit the system environment variables"
- Click "Environment Variables"
- Double-click 'Path' under 'User variables'
- Click "New"
- Add
C:\msys64\ucrt64\bin - Click OK to save
- In a new regular terminal (Command Prompt or PowerShell), set short temp paths and install:
mkdir C:\T set TEMP=C:\T set TMP=C:\T
Winlibs
- Download a pre-built MinGW-w64 bundle from winlibs.com
- Extract it anywhere on your system
- Add the
bin\folder to your PATH:- Search for "env" in the Start menu
- Select "Edit the system environment variables"
- Click "Environment Variables"
- Double-click 'Path' under 'User variables'
- Click "New"
- Add the full path to the
binfolder (e.g.,C:\mingw\bin) - Click OK to save
- In a new terminal, set short temp paths and install:
mkdir C:\T set TEMP=C:\T set TMP=C:\T
Then continue with the instructions below. Either pip install or use build manually.
Note
Windows arm64 is not tested and is not officially supported.
Please ensure you have followed the prequisite steps above before installing!
Direct installation using pip:
pip install glowpython2Install from source repository:
git clone https://github.com/sunipkm/glowpython2
cd glowpython2
pip install .Note: editable installs (
pip install -e .) are not supported — meson-python's editable mode does not correctly stage the data files required by the Fortran backend. After modifying Fortran source, re-runpip install .to rebuild.If you just want to download the latest commit & build it from source, use:
pip install glowpython2@git+https://github.com/sunipkm/glowpython2
Requires (and installs) geomagdata for timezone aware geomagnetic parameter retrieval.
Glow2Maxwellian: asdfGlow2NoPrecip: asdf
This is a work in progress!
In Python source code, import the module and call the maxwellian function:
import glowpython2 as glow
iono = glow.maxwellian(time, glat, glon, Nbins, Q, Echar)Read the module documentation for more information.
Example scripts are in Examples/. These examples cover no-precipitation and Maxwellian runs, GLOW model comparisons across atmosphere/ionosphere configurations, and side-by-side IRI and MSIS model comparisons.
| Densities | Temperatures |
|---|---|
![]() |
![]() |
| Volume Emission Rates | IRI Comparison | MSIS Comparison |
|---|---|---|
![]() |
![]() |
![]() |
GlowPython2 has a few configuration options at runtime -
- Magnetic field model: Use
POGO68for GLOW 0.98 behavior,IGRF14for the IGRF-14 model (extracted from IRI-2020). - Atmosphere and ionosphere model: Use
MSIS00_IRI90for GLOW 0.98 behavior,MSIS21_IRI20for NRLMSIS 2.1 and IRI-2020. - New coefficients from ModGLOW implementation: Set
newcoeffstoTrue. This updates the reaction rates with data from newer publications.
The returned output is a xarray.Dataset containing outputs from GLOW:
- Coordinates:
alt_km: Altitude grid (km)energy: Energy grid (eV)state: Neutral/Ionic excitation states (string)wavelength: Wavelength of emission features in Angstrom (string). Represented as strings to accommodate the LBH band.tecscale: TEC scale factor (float)
- Data:
- Dimension (
alt_km):O: Neutral atomic oxygen density (cm^-3)O2: Neutral molecular oxygen density (cm^-3)N2: Neutral molecular nitrogen density (cm^-3)NO: Neutral nitric oxide density (cm^-3)NS: N(4S) density (cm^-3)ND: N(2D) density (not used, set to zero) (cm^-3)NeIn: Electron density (IRI-90), input to GLOW radiative transfer model. (cm^-3)O+: Ion atomic oxygen (4S) density (cm^-3)O+(2P): Ion atomic oxygen (2P) density (cm^-3)O+(2D): Ion atomic oxygen (2D) density (cm^-3)O2+: Ion molecular oxygen density (cm^-3)N+: Ion molecular nitrogen density (cm^-3)N2+: Ion molecular nitrogen density (cm^-3)NO+: Ion nitric oxide density (cm^-3)N2(A): Molecular nitrogen (GLOW) density (cm^-3)N(2P): N(2P) density (cm^-3)N(2D): N(2D) density (cm^-3)O(1S): O(1S) density (cm^-3)O(1D): O(1D) density (cm^-3)NeOut: Electron density (calculated below 200 km forkchem=4using GLOW model, cm^-3)Te: Electron temperature (K)Ti: Ion temperature (K)Tn: Neutral temperature (K)ionrate: Ionization rate (s^-1)pederson: Pederson conductivity (S/m)hall: Hall conductivity (S/m)eHeat: Ambient electron heating rate (eV/cm^3/s)Tez: Total energetic electron energy deposition (eV/cm^3/s)
- Dimension (
alt_km,wavelength):ver: Volume emission rate of various features (1/cm^3/s)
- Dimension (
alt_km,state):production: Production rate of various species (1/cm^3/s)loss: Fractional loss rate of various species (1/s)
- Dimension (
energy):precip: Precipitation flux (cm^-2/s/eV)
- Dimension (
- Attributes:
time: Time of evaluation (ISO 8601 formatted string)glatlon: Geographic latitude and longitude of evaluation (degrees)Q: Flux of precipitating electrons (erg/cm^2/s)Echar: Characteristic energy of precipitating electrons (eV)iscale: Solar flux model. 0: Hinteregger, 1: EUVACxuvfac: XUV enhancement factor.itail: Low energy tail enabled/disabled. 0: disabled, 1: enabledfmono: Monoenergetic energy flux (erg/cm^2).emono: Monoenergetic characteristic energy (keV).jlocal: Local calculation only (disable electron transport).kchem: GLOW chemistry level.
All available keys carry unit and description.
Sincerest gratitude to Dr. Stan Solomon for developing, and open-sourcing the GLOW model.
We are very thankful to Guy Gribbs for providing the gchem_modglow.f90 file with the modified reaction rate coefficients for the GCHEM subroutine. His prompt response saved us many hours of work.
If you use this code in your work, please cite the repository:
@software{sunipkm_glowpython2_2025,
author = {Sunip K. Mukherjee},
title = {{glowpython2}: A Python Wrapper for the GLOW Model},
month = nov,
year = 2025,
publisher = {GitHub},
version = {v0.0.1},
doi = {https://zenodo.org/badge/latestdoi/1026267765},
url = {https://github.com/sunipkm/glowpython2},
}



