IGRF 13 in Python
International Geomagnetic Reference Field: IGRF13 in object-oriented Python or Matlab.
Install
A Fortran compiler is required, such as gfortran:
- Linux:
apt install gfortran - Mac:
brew install gcc - gfortran for Windows (MinGW)
To get the IGRF Python development version, git clone and then:
python -m pip install -e .
Otherwise, for the latest release from PyPi:
python -m pip install igrf
Optionally, test the install with:
pytest
Example
To make the plots in this readme:
igrf
using as a Python module at geodetic coordinates 65N, 148W:
import igrf
mag = igrf.igrf('2010-07-12', glat=65, glon=-148, alt_km=100)
returns an xarray.Dataset:
<xarray.Dataset>
Dimensions: (alt_km: 1)
Coordinates:
* alt_km (alt_km) int64 100
Data variables:
north (alt_km) float64 1.122e+04
east (alt_km) float64 4.148e+03
down (alt_km) float64 5.302e+04
total (alt_km) float64 5.436e+04
incl (alt_km) float64 77.29
decl (alt_km) float64 20.29
Matlab
Matlab can seamlessly call Python modules, as used in igrf.m. Instead of the $1000 Aerospace Toolbox, use this free IGRF for Matlab like:
igrf.igrf(datetime(2020,1,3,5,4,22), 20, 60, 0)
You may find it helpful to run "setup.m" first to setup the library paths.
References
Metadata
Release files for igrf 13.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| igrf-13.0.2.tar.gz | 22.4 kB | Without provenance | Details |
Release files / igrf-13.0.2.tar.gz
| Download URL | igrf-13.0.2.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
867caa2c8dffe87b42f6187afb97a92e60c08c4e49ac5a57a46112e3121ca1a9
|
|
BLAKE2b-256 checksum How to use checksums |
3685ae744fbfce30839bc1dbb6786a0bda9d1b839267497010e3a8d6d0ad591c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7
|
Security for igrf 13.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.