Python bindings for NCAR GLOW model
Project description
GlowPython
The FORTRAN GLobal airglOW (GLOW) Model in Python ≥ 3.9.
A Fortran compiler is REQUIRED.
Note: This version uses meson and ninja as the build system, and does not rely on distutils,
and is Python 3.12 compatible.
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.
Prerequisites
A Fortran compiler is REQUIRED.
Linux
Ensure that you have the following development packages installed:
build-essential(forgcc,g++,make, etc.)gfortran(Fortran compiler)
macOS
Ensure that you have the Xcode Command Line Tools installed. You can install them by running:
xcode-select --install
Install homebrew if you haven't already, and then install gfortran:
brew install gfortran
Note: 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.
Windows
The Windows installation is not officially supported at this time. However, you can try installing the MinGW-w64 toolchain and ensure that gfortran is available in your system's PATH. You may also consider using the Windows Subsystem for Linux (WSL) to set up a Linux-like environment on your Windows machine.
Installation
Direct installation using pip:
pip install glowpython2
Install from source repository:
pip install glowpython2@git+https://github.com/sunipkm/glowpython2
Requires (and installs) geomagdata for timezone aware geomagnetic parameter retrieval.
Usage
Pre-defined examples
Maxwellian.py: Maxwellian precipitation, specify Q (flux) and E0 (characteristic energy).NoPrecipitation.py: No precipitating electrons.test_glow.py: Compares GLOW results betweenglowpythonandglowpython2modules without precipitation, as well as with NRLMSISE-2.1 atmosphere and IRI-2020 ionosphere.
These examples are also available on the command line: Glow2Maxwellian and Glow2NoPrecip.
Using glowpython2 module
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 Plots
| Densities | Temperatures |
|---|---|
| Volume Emission Rates |
|---|
Model Output
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.
Citation
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},
}
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
File details
Details for the file glowpython2-0.0.1.tar.gz.
File metadata
- Download URL: glowpython2-0.0.1.tar.gz
- Upload date:
- Size: 5.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
949088c85ab0169805f91011c8209b62489f36dbd688d9b3e39b29f05271432c
|
|
| MD5 |
5aa6c1e77dc69f5f621600a5d9d05c3a
|
|
| BLAKE2b-256 |
e6b25586385a9c2f8755887debed390fd7b9f0e7f19da4ad88a527d123414373
|