IGRF 2012 in Python
International Geomagnetic Reference Field IGRF12 and IGRF11...in simple, object-oriented Python ≥ 3.6 or Matlab.
Install
A Fortran compiler is required, such as gfortran:
-
Linux:
apt install gfortran -
Mac:
brew install gcc -
gfortran for Windows (MinGW) Windows only: from Powershell:
echo "[build]`ncompiler=mingw32" | Out-File -Encoding ASCII ~/pydistutils.cfg
To get the IGRF12 development version, git clone and then:
python -m pip install -e .
Otherwise, for the latest release from PyPi:
python -m pip install igrf12
Optionally, test the install with:
pytest
Windows
If you get ImportError on Windows for the Fortran module, try from the iri2016 directory:
del *.pyd
python setup.py build_ext --inplace --compiler=mingw32
Example
To make the plots in this readme:
igrf12
using as a Python module at geodetic coordinates 65N, 148W:
import igrf12
mag = igrf12.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
The IGRF model may be specified with the igrf12.igrf(model=) option:
11: IGRF1112: IGRF12
Matlab
Matlab can seamlessly call Python modules, as in igrf12.m.
Instead of the $1000 Aerospace Toolbox, use this free IGRF12 for Matlab.
Reference
If you only want the plain Fortran program, you can do:
cmake -B build
cmake --build build --parallel
./testigrf
References
- IGRF12 Fortran code
- IGRF11 Fortran code
- WMM2015 inclination map
- WMM2015 declination map
Metadata
Release files for igrf12 1.3.6
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 | Actions |
|---|---|---|---|---|
| igrf12-1.3.6.tar.gz | 26.1 kB | Without provenance | Details for igrf12-1.3.6.tar.gz |
Release files / igrf12-1.3.6.tar.gz
| Download URL | igrf12-1.3.6.tar.gz |
|---|---|
| Size | 26.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
99304b8a9875c3c9fa740be32dd39232c8c38f3a2dbdb9fd74e41c737d43e8cb
|
|
BLAKE2b-256 checksum How to use checksums |
9ab4d51fafc4e19be077112b44c856bfdbe83cb679db806dab28cc5c62232c4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Security for igrf12 1.3.6
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.