{"id":15716399,"url":"https://github.com/space-physics/igrf","last_synced_at":"2026-03-16T16:40:08.051Z","repository":{"id":29525899,"uuid":"33064474","full_name":"space-physics/igrf","owner":"space-physics","description":"International Geomagnetic Reference Field IGRF13 in Python and Matlab","archived":false,"fork":false,"pushed_at":"2024-08-23T22:40:41.000Z","size":667,"stargazers_count":69,"open_issues_count":6,"forks_count":28,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-15T18:18:44.489Z","etag":null,"topics":["fortran","geomagnetic","igrf","igrf12","igrf13","matlab","matlab-python-interface","python"],"latest_commit_sha":null,"homepage":"https://www.ngdc.noaa.gov/IAGA/vmod/","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/space-physics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["scivision"],"ko_fi":"scivision"}},"created_at":"2015-03-29T06:55:18.000Z","updated_at":"2025-02-13T07:47:16.000Z","dependencies_parsed_at":"2024-10-24T13:09:51.921Z","dependency_job_id":"59a1712e-34d3-4f27-a10e-dd6d25986819","html_url":"https://github.com/space-physics/igrf","commit_stats":{"total_commits":122,"total_committers":3,"mean_commits":"40.666666666666664","dds":0.2786885245901639,"last_synced_commit":"b7770008cb44ba61cb6efdf24a16e72fac576106"},"previous_names":["space-physics/igrf12"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/space-physics/igrf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-physics%2Figrf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-physics%2Figrf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-physics%2Figrf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-physics%2Figrf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/space-physics","download_url":"https://codeload.github.com/space-physics/igrf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/space-physics%2Figrf/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260081634,"owners_count":22956151,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fortran","geomagnetic","igrf","igrf12","igrf13","matlab","matlab-python-interface","python"],"created_at":"2024-10-03T21:45:29.539Z","updated_at":"2026-03-16T16:40:07.107Z","avatar_url":"https://github.com/space-physics.png","language":"Fortran","funding_links":["https://github.com/sponsors/scivision","https://ko-fi.com/scivision"],"categories":[],"sub_categories":[],"readme":"# IGRF 13 in Python\n\n[![DOI](https://zenodo.org/badge/33064474.svg)](https://zenodo.org/badge/latestdoi/33064474)\n![Actions Status](https://github.com/space-physics/igrf/workflows/ci/badge.svg)\n\n[![Python versions (PyPI)](https://img.shields.io/pypi/pyversions/igrf.svg)](https://pypi.python.org/pypi/igrf)\n[![PyPi Download stats](http://pepy.tech/badge/igrf)](http://pepy.tech/project/igrf)\n\nInternational Geomagnetic Reference Field: IGRF13 in object-oriented Python or Matlab.\n\n![image](src/igrf/tests/incldecl.png)\n\n![image](src/igrf/tests/vectors.png)\n\n## Install\n\nA Fortran compiler is required, such as `gfortran`:\n\n* Linux: `apt install gfortran`\n* Mac: `brew install gcc`\n* [gfortran for Windows](https://www.scivision.dev/windows-gcc-gfortran-cmake-make-install/) (MinGW)\n\nTo get the IGRF Python development version, `git clone` and then:\n\n```sh\npython -m pip install -e .\n```\n\nOtherwise, for the latest release from PyPI:\n\n```sh\npython -m pip install igrf\n```\n\nThe first time you install IGRF, do once from Python:\n\n```python\nimport igrf\n\nigrf.build()\n```\n\nOptionally, test the install with:\n\n```sh\npytest\n```\n\n## Example\n\nTo make the plots in this readme:\n\n```sh\nigrf\n```\n\nusing as a Python module at geodetic coordinates 65N, 148W:\n\n```python\nimport igrf\n\nmag = igrf.igrf('2010-07-12', glat=65, glon=-148, alt_km=100)\n```\n\nreturns an `xarray.Dataset`:\n\n```\n\u003cxarray.Dataset\u003e\nDimensions:  (alt_km: 1)\nCoordinates:\n  * alt_km   (alt_km) int64 100\nData variables:\n    north    (alt_km) float64 1.122e+04\n    east     (alt_km) float64 4.148e+03\n    down     (alt_km) float64 5.302e+04\n    total    (alt_km) float64 5.436e+04\n    incl     (alt_km) float64 77.29\n    decl     (alt_km) float64 20.29\n```\n\n### Matlab\n\nMatlab can seamlessly call Python modules, as used in [igrf.m](./+igrf/igrf.m).\nInstead of the $1000 Aerospace Toolbox, use this free IGRF for Matlab like:\n\n```matlab\nigrf.igrf(datetime(2020,1,3,5,4,22), 20, 60, 0)\n```\n\nYou may find it helpful to run \"setup.m\" first to setup the library paths.\n\n### References\n\n* [IGRF13 Fortran code](http://www.ngdc.noaa.gov/IAGA/vmod/igrf13.f)\n* [IGRF12 Fortran code](http://www.ngdc.noaa.gov/IAGA/vmod/igrf12.f)\n* [IGRF11 Fortran code](http://www.ngdc.noaa.gov/IAGA/vmod/igrf11.f)\n* WMM2015 [inclination map](https://www.ngdc.noaa.gov/geomag/WMM/data/WMM2015/WMM2015_I_MERC.pdf)\n* WMM2015 [declination map](https://www.ngdc.noaa.gov/geomag/WMM/data/WMM2015/WMM2015_D_MERC.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspace-physics%2Figrf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspace-physics%2Figrf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspace-physics%2Figrf/lists"}