Geopack-2008 — GEOPACK-2008 geomagnetic field model for Python
Geopack-2008 (imported as geopack) is a high-performance, self-contained, zero-dependency Python package for the
GEOPACK-2008 geomagnetic field model: the International Geomagnetic
Reference Field (IGRF), the dipole field, the Tsyganenko (1989)
external field model (T89), the Shue et al. (1998) and Tsyganenko (1996)
magnetopause models, the Sun position computation, and the standard
solar-terrestrial coordinate transforms (GEO, GSW, GSE, SM, MAG, GEI, GSM).
It is a Python binding over a C# port of GEOPACK-2008
compiled ahead-of-time with NativeAOT into a shared library (geopack.dylib /
geopack.so / geopack.dll), loaded through ctypes from the Python standard
library. No .NET runtime is required at runtime, and there are no Python
dependencies (no NumPy/SciPy).
- High performance: native compiled code with SIMD vectorization and other optimized mathematical operations
- Double precision: accuracy matches the original Fortran code to 12–13 decimal digits
- Standard library only — no third-party runtime dependencies
- Thread-safe immutable computation contexts
- Platform wheels for Linux (x64/arm64), Windows (x64/arm64) and macOS (arm64)
Install
pip install geopack-2008
Pre-built wheels are published to PyPI for Linux (x64/arm64, manylinux),
Windows (x64/arm64) and macOS (arm64) — no .NET SDK or C toolchain required.
To build the wheel from source (e.g. for another platform or during
development), see BUILDING.md.
Usage
import geopack
ctx = geopack.recalc(1997, 12, 16, 21, 0, 0, vx=-304, vy=13.78, vz=4)
b = ctx.igrf_gsw(1, 1, 1) # (bx, by, bz) nT in GSW
r = ctx.gsw_to_geo(1, 1, 1) # (x, y, z) Earth radii in GEO
ctx.close()
# A datetime works too, and contexts are context managers:
with geopack.recalc(datetime(1997, 12, 16, 21, 0), vx=-304, vy=13.78, vz=4) as ctx:
b = ctx.igrf_gsw(1, 1, 1)
s = geopack.sun(1997, 12, 16, 21, 0, 0) # (gst, slong, srasn, sdec), radians
mp = geopack.shu_mgnp(xn_pd=2.0, vel=400.0, bz_imf=0.0, x=10, y=0, z=0)
print(mp.boundary, mp.dist, mp.position) # Vector3, float, MagnetopausePosition
# Tsyganenko (1989) external field — input GSW, output GSM (nT):
b = geopack.t89(iopt=3, psi=ctx.psi, x=-6.6, y=0, z=0)
b = ctx.t89(iopt=3, x=-6.6, y=0, z=0) # psi defaults to ctx.psi
A runnable example with all of the above (sun position, IGRF/dipole fields,
coordinate transforms, magnetopause models) is in
python/example.py:
python3 python/example.py
Implemented models and coordinate systems
| Category | Model | Python API |
|---|---|---|
| Internal field | IGRF (geomagnetic main field) | Context.igrf_gsw, Context.igrf_geo |
| Internal field | Dipole | Context.dip |
| External field | Tsyganenko (1989) — T89 | Context.t89, geopack.t89 |
| Magnetopause | Shue et al. (1998) | geopack.shu_mgnp |
| Magnetopause | Tsyganenko (1996) | geopack.t96_mgnp |
| Sun position | Greenwich sidereal time, solar ephemeris | geopack.sun |
Supported coordinate systems (see CoordinateSystem): GEO (geographic),
GSW (geocentric solar wind), GSE (geocentric solar ecliptic),
SM (solar magnetic), MAG (geomagnetic), GEI (geocentric solar
equatorial inertial) and GSM (geocentric solar magnetospheric).
API
All coordinates are in Earth radii; magnetic fields are in nT; angles are in radians; solar wind velocity is in km/s.
recalc(date_or_year, month=None, day=None, hour=0, minute=0, second=0, vx=-400, vy=0, vz=0) -> ContextContextmethods:- fields:
igrf_gsw(x,y,z),dip(x,y,z),igrf_geo(r,theta,phi),t89(iopt,x,y,z, psi=None), propertypsi(dipole tilt, radians) - transforms:
gsw_to_gse,gse_to_gsw,geo_to_mag,mag_to_geo,gei_to_geo,geo_to_gei,mag_to_sm,sm_to_mag,sm_to_gsw,gsw_to_sm,geo_to_gsw,gsw_to_geo— each(x,y,z) -> (x,y,z) - lifecycle:
close(), context manager
- fields:
sun(...) -> Sun(gst, slong, srasn, sdec)— no context neededshu_mgnp(xn_pd, vel, bz_imf, x, y, z)andt96_mgnp(xn_pd, vel, x, y, z)returnMagnetopauseResult(boundary, dist, position)— no context neededt89(iopt, psi, x, y, z, parmod=None) -> Vector3— Tsyganenko (1989) external field, input GSW, output GSM (nT);parmodis a dummy accepted for parity with the .NETIT89.Calculatecontract (unused) — no context needed
GEOPACK_LIBRARY environment variable points the loader at a specific library
path if the packaged one is not present.
How to Cite
If you use this software in your research, please cite it — see the
How to Cite
section of the main repository README (APA and BibTeX entries with a Zenodo DOI).
References
The implementation is based on the GEOPACK-2008 library and the following scientific works:
-
Tsyganenko, N. A. (1989). A magnetospheric magnetic field model with a warped tail current sheet. Planetary and Space Science, 37(1), 5–20. https://doi.org/10.1016/0032-0633(89)90066-4
-
Tsyganenko, N. A. (1996). Effects of the solar wind conditions on the global magnetospheric configuration as deduced from data-based field models. ESA SP-389, 181–185.
-
Shue, J.-H., et al. (1998). Magnetopause location under extreme solar wind conditions. Journal of Geophysical Research, 103(A8), 17691–17700. https://doi.org/10.1029/98JA01103
-
Hapgood, M. A. (1992). Space physics coordinate transformations: A user guide. Planetary and Space Science, 40(5), 711–717. https://doi.org/10.1016/0032-0633(92)90012-D
-
Tsyganenko, N. A. (2002). A model of the near magnetosphere with a dawn-dusk asymmetry 1. Mathematical structure. Journal of Geophysical Research, 107(A8). https://doi.org/10.1029/2001JA000219
-
Tsyganenko, N. A., & Sitnov, M. I. (2005). Modeling the dynamics of the inner magnetosphere during strong geomagnetic storms. Journal of Geophysical Research: Space Physics, 110(A3), A03208. https://doi.org/10.1029/2004JA010798
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file geopack_2008-2.2.5-py3-none-win_arm64.whl.
File metadata
- Download URL: geopack_2008-2.2.5-py3-none-win_arm64.whl
- Upload date:
- Size: 665.1 kB
- Tags: Python 3, Windows ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21fb1efad26d7196c53e223488d58474cbde0c30a47cd64059ea26fa1e4787c3
|
|
| MD5 |
009caa724aedf85e278e4653a921a120
|
|
| BLAKE2b-256 |
90dcdd61464a23dc353a14b958cccde64fc93f168c0db2addca5a1efbf623ca0
|
Provenance
The following attestation bundles were made for geopack_2008-2.2.5-py3-none-win_arm64.whl:
Publisher:
python-package.yml on Aurora-Science-Hub/Geopack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
geopack_2008-2.2.5-py3-none-win_arm64.whl -
Subject digest:
21fb1efad26d7196c53e223488d58474cbde0c30a47cd64059ea26fa1e4787c3 - Sigstore transparency entry: 2580012012
- Sigstore integration time:
-
Permalink:
Aurora-Science-Hub/Geopack@8fb1d83dced8b64718953a11b770c0b00aae64ba -
Branch / Tag:
refs/heads/pypi_publishing - Owner: https://github.com/Aurora-Science-Hub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package.yml@8fb1d83dced8b64718953a11b770c0b00aae64ba -
Trigger Event:
push
-
Statement type:
File details
Details for the file geopack_2008-2.2.5-py3-none-win_amd64.whl.
File metadata
- Download URL: geopack_2008-2.2.5-py3-none-win_amd64.whl
- Upload date:
- Size: 711.5 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70ef61488148d4dd25e1e37ab6ca8114c40fd5764da2b66e94cc939a26db013c
|
|
| MD5 |
7729c0315bfdf5ca121fa73c8e92026d
|
|
| BLAKE2b-256 |
ad30d484c778dd7d3a52a416081e01e6ad6068889a689a2d4e51a097895861b0
|
Provenance
The following attestation bundles were made for geopack_2008-2.2.5-py3-none-win_amd64.whl:
Publisher:
python-package.yml on Aurora-Science-Hub/Geopack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
geopack_2008-2.2.5-py3-none-win_amd64.whl -
Subject digest:
70ef61488148d4dd25e1e37ab6ca8114c40fd5764da2b66e94cc939a26db013c - Sigstore transparency entry: 2580011999
- Sigstore integration time:
-
Permalink:
Aurora-Science-Hub/Geopack@8fb1d83dced8b64718953a11b770c0b00aae64ba -
Branch / Tag:
refs/heads/pypi_publishing - Owner: https://github.com/Aurora-Science-Hub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package.yml@8fb1d83dced8b64718953a11b770c0b00aae64ba -
Trigger Event:
push
-
Statement type:
File details
Details for the file geopack_2008-2.2.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: geopack_2008-2.2.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 737.8 kB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d916b4c7b6a00d4d0573a0fdd8afec5e9d0b72200b4f303cefa0eb26c38e1795
|
|
| MD5 |
b69e02bcb0913dcd3096486e957e509c
|
|
| BLAKE2b-256 |
03ac5e555eb5391b55dc304daf8c1fb37dfa1ccf406f106d78260ccc7fb66cba
|
Provenance
The following attestation bundles were made for geopack_2008-2.2.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
python-package.yml on Aurora-Science-Hub/Geopack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
geopack_2008-2.2.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
d916b4c7b6a00d4d0573a0fdd8afec5e9d0b72200b4f303cefa0eb26c38e1795 - Sigstore transparency entry: 2580012001
- Sigstore integration time:
-
Permalink:
Aurora-Science-Hub/Geopack@8fb1d83dced8b64718953a11b770c0b00aae64ba -
Branch / Tag:
refs/heads/pypi_publishing - Owner: https://github.com/Aurora-Science-Hub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package.yml@8fb1d83dced8b64718953a11b770c0b00aae64ba -
Trigger Event:
push
-
Statement type:
File details
Details for the file geopack_2008-2.2.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: geopack_2008-2.2.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 698.7 kB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f0e61e4368298f0ec129973971aac8e80777c20baa71481ff5c2b9ea7535aa2
|
|
| MD5 |
8272c8c6718d13030d118aab96241745
|
|
| BLAKE2b-256 |
34ffed9a987d2211e38bbeb8226e1175e110fa9d43be39c9a21e5d044640705f
|
Provenance
The following attestation bundles were made for geopack_2008-2.2.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl:
Publisher:
python-package.yml on Aurora-Science-Hub/Geopack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
geopack_2008-2.2.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl -
Subject digest:
2f0e61e4368298f0ec129973971aac8e80777c20baa71481ff5c2b9ea7535aa2 - Sigstore transparency entry: 2580012007
- Sigstore integration time:
-
Permalink:
Aurora-Science-Hub/Geopack@8fb1d83dced8b64718953a11b770c0b00aae64ba -
Branch / Tag:
refs/heads/pypi_publishing - Owner: https://github.com/Aurora-Science-Hub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package.yml@8fb1d83dced8b64718953a11b770c0b00aae64ba -
Trigger Event:
push
-
Statement type:
File details
Details for the file geopack_2008-2.2.5-py3-none-macosx_12_0_arm64.whl.
File metadata
- Download URL: geopack_2008-2.2.5-py3-none-macosx_12_0_arm64.whl
- Upload date:
- Size: 678.9 kB
- Tags: Python 3, macOS 12.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39dde93951a8dda85d752fc09ede0cd033c56b224e2c6305ffd4063742ebdd2e
|
|
| MD5 |
a7f1255910662b107ffef00126224d69
|
|
| BLAKE2b-256 |
46848c894171dbd3179ab5ac45fce570dc6d241f1c42a1a5188bb098554c4547
|
Provenance
The following attestation bundles were made for geopack_2008-2.2.5-py3-none-macosx_12_0_arm64.whl:
Publisher:
python-package.yml on Aurora-Science-Hub/Geopack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
geopack_2008-2.2.5-py3-none-macosx_12_0_arm64.whl -
Subject digest:
39dde93951a8dda85d752fc09ede0cd033c56b224e2c6305ffd4063742ebdd2e - Sigstore transparency entry: 2580012015
- Sigstore integration time:
-
Permalink:
Aurora-Science-Hub/Geopack@8fb1d83dced8b64718953a11b770c0b00aae64ba -
Branch / Tag:
refs/heads/pypi_publishing - Owner: https://github.com/Aurora-Science-Hub
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-package.yml@8fb1d83dced8b64718953a11b770c0b00aae64ba -
Trigger Event:
push
-
Statement type: