Skip to main content

Python bindings for IRI-2020 model

Project description

DOI

IRI-2020 Python Wrapper

iri20py is a wrapper around the IRI-2020 empirical model.

This repository includes a version of the IRI-2020 model where the call signatures have been modified for ease of integration with Python. The integration is achieved by means of a FORTRAN shim (irishim.f90) that is compiled into a module using F2PY. Data files associated with IRI-2020 are included in the data folder and are available at runtime. The wrapper automatically retrieves the latest available ig_rz.dat and apf107.dat files on import.

Installation

A Fortran compiler is REQUIRED to build the FORTRAN extension module.

From PyPI

pip install iri20py

From GitHub

pip install iri20py@git+https://github.com/sunipkm/iri20py

Usage

from iri20py import Iri2020, alt_grid
from datetime import datetime, UTC
import matplotlib.pyplot as plt

# Instantiate the model
iri = Iri2020()
# Note: iri is a singleton (thread safety with FORTRAN)
# Evaluate the model
_, ds = iri.evaluate(
    datetime(2022, 3, 12, 0, 0, 0, tzinfo=UTC),
    40, -70,
    alt_grid()
)

# ds is an xarray Dataset
# Plot electron density profile
ds.Ne.plot(y='alt_km')
plt.show()

Output Dataset Format

  • Coordinates
    • Altitude (alt_km): Altitude in km
  • Data Variables (as a function of altitude)
    • Electron density (Ne) in cm-3
    • Electron temperature (Te) in K
    • Ion temperature (Ti) in K
    • O+, H+, He+, O2+, NO+, N+ and cluster ion densities (cm-3)
  • Attributes
    • settings: JSON string of settings (iri20py.Settings) used to evaluate the model.
    • date: ISO formatted date and time for which the model was evaluated.
    • lat and lon: Latitude and longitude for where the model was evaluated.
    • Additional attributes as returned in the OARR struct (refer to IRI-2020 documentation). These additional attributes are provided as JSON dictionaries containing a value, its unit, a longer name (long_name) and an associated description, if available.

The dataset is NetCDF4 compatible.

Example Plot

An example script to generate the following plot is available in the tests/test_iri2020.py file. Example IRI-2020 Output

Citation

If you use this code in your work, please cite the repository:

@software{sunipkm_iri20py_2025,
  author       = {Sunip K. Mukherjee},
  title        = {{iri20py}: A Python Wrapper for the IRI-2020 Empirical Model},
  month        = nov,
  year         = 2025,
  publisher    = {GitHub},
  version      = {v0.0.2},
  doi          = {https://zenodo.org/badge/latestdoi/1089134543},
  url          = {https://github.com/sunipkm/iri20py},
}

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

iri20py-0.0.2.tar.gz (2.2 MB view details)

Uploaded Source

File details

Details for the file iri20py-0.0.2.tar.gz.

File metadata

  • Download URL: iri20py-0.0.2.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for iri20py-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8d5b8fc074b3ba5a1e98797c252edffb52fddd735b1db4a8a6f722828be7c02b
MD5 ae51613c064a29c4b5f30a185cca9a8b
BLAKE2b-256 9ece7c28eb5837045bc1deefa0b05433b70b49dd55219e7745b87617b423b0a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page