IGRF12 model with simple object-oriented Python interface'.
Project description
IGRF 2012 in Python
International Geomagnetic Reference Field IGRF12 and IGRF11...in simple, object-oriented Python >= 3.6.
Install
To get the 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
- install gfortran for Windows (MinGW)
- build the Fortran modules, forcing the MinGW compilers to be used instead of Visual Studio.
python setup.py build_ext --inplace --compiler=mingw32
- install the rest
pip install -e .
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
Reference
If you only want the plain Fortran program, you can do:
cd bin
cmake ../src
cmake --build .
./testigrf
References
- IGRF12 Fortran code
- IGRF11 Fortran code
- WMM2015 inclination map
- WMM2015 declination map
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
igrf12-1.3.4.tar.gz
(403.2 kB
view hashes)