Python interface to the International Reference Ionosphere (IRI) 2020 model. The original Fortran code was ported to Rust for better performance and reliability. The Fortran code is still a part of the repository for reference. But the whole Fortran codebase was ported to Rust and the Rust code is now used in the Python interface.
Prerequisites
- Rust compiler--any modern Rust compiler will do. Here's how to get Rust:
- Linux:
apt install rustc - Mac:
brew install rust - Windows Subsystem for Linux
- Linux:
and then install latest release:
git clone https://github.com/leo-gan/iri2020
cd iri2020
uv pip install .src/data/
data files
are
regularly updated.
Currently we don't auto-update those.
This project now includes a 100% pure Rust port of the IRI2020 model, removing the Fortran compilation and compiler dependency entirely. The Rust implementation provides:
- Thread Safety: Eliminates Fortran process-global common blocks and mutable globals, allowing safe parallel execution
- Fast Build Times: No Fortran compilers (like
gfortran) orcmakewrappers needed - Numerical Precision: Maintains equivalence with the original Fortran implementation through rigorous testing
Detailed documentation is available in the docs/ directory:
- Algorithmic Reference: Scientific foundations and mathematical models implemented in the Rust codebase, including IGRF-13, CIRA-86, ROCSAT-1 drift, and electron density profile construction
- Porting Documentation: Software engineering process for the Fortran to Rust translation, including bug fixes and verification methodology
- Package Documentation: Architecture overview, testing procedures, and key features of the Rust implementation
The Rust port is built with Maturin (PyO3) and can be installed with:
uv pip install .Optional learned surrogates approximate IRI2020 pointwise outputs for fast evaluation, with preprocessing for periodic drivers and multi-decade densities, two neural architectures (Deep Residual MLP + Fourier features; FiLM-conditioned MLP), a deep ensemble for uncertainty, and an XGBoost baseline.
Short smoke training + benchmark (verify convergence and metrics, not production accuracy):
source .venv/bin/activate
uv pip install torch xgboost scikit-learn joblib # once
python -m iri2020.surrogate.scripts.run_pipeline \
--n-train 600 --epochs 6 --artifact-dir surrogate_artifactsOutputs land in surrogate_artifacts/ (benchmark_report.json, model weights, preprocessor).
Full design notes, trade-offs, critiques, and roadmap: docs/surrogate.md.
Caveats: surrogates approximate the empirical model (Rust runtime), not measurements. Default runs are intentionally short. Fortran is present in-tree but not called from Python; the benchmark documents that gap rather than inventing numbers.