Skip to main content

IGRF13, IGRF12, IGRF11 models with simple object-oriented Python interface.

Project description

IGRF 13 in Python

DOI Actions Status Language grade: Python

Python versions (PyPI) PyPi Download stats

International Geomagnetic Reference Field: IGRF13 in object-oriented Python or Matlab.

image

image

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 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

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

igrf-13.0.0.tar.gz (23.9 kB view details)

Uploaded Source

File details

Details for the file igrf-13.0.0.tar.gz.

File metadata

  • Download URL: igrf-13.0.0.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1.post20200622 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for igrf-13.0.0.tar.gz
Algorithm Hash digest
SHA256 362a5713b507f4580ae58101cfc37748645520fbf996c03d9efb7509fd3c82fc
MD5 7af2975a8f5c906bfb6f78d014a07ae3
BLAKE2b-256 3b6078fa39eae34b959669e18677df851aee78d43a0d4461e4747baeaa77cd50

See more details on using hashes here.

Supported by

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