pymaginverse
Library for the numerical inversion of geomagnetic field data. This library is brough to you by Frenk Out, Maximilian Schanner, Liz van Grinsven, Monika Korte, and Lennart de Groot. This code is based on Fortran code used for the following two papers:
- Korte, M., & Constable, C. (2003). Continuous global geomagnetic field models for the past 3000 years. Physics of the Earth and Planetary Interiors, 140(1-3), 73-89. 10.1016/j.pepi.2003.07.013
- Korte, M., Donadini, F., & Constable, C. G. (2009). Geomagnetic field for 0–3 ka: 2. A new series of time‐varying global models. Geochemistry, Geophysics, Geosystems, 10(6). 10.1029/2008GC002297
Library
The library consists of two main modules:
pymaginverse/data_prep.py: contains methods for correctly preparing data for theFieldInversion-class. This method stores all required parameters per station into one class, which can then be imported directly intoFieldInversion. The class takes a csv-file of declination, inclination, intensity, x, y, z, and/or h-component magnetic data + accompanying data errors.pymaginverse/field_inversion.py: contains theFieldInversion-class that performs the actual inversion of geomagnetic field data. It requires, besides the time vector over which the inversion will take place, an instance ofInputDataas minimum input.
Installation
option a: pip
The easiest way to get a working environment set up is using the conda dependency manager, e.g. from here. Replacing with a name of your choice, you can create a conda environment with all dependencies provided using:
conda create --name <env-name> "python==3.11"
Then, activate your environment
conda activate <env-name>
Subsequently, either enter the root directory of the repository (which you should have downloaded with either git clone or the download button above), to install the package:
pip install . -U
or pip install directly from the pypi repository:
pip install pymaginverse
Option b: poetry
In order to get the inversion code running with poetry, you need to have poetry properly installed. See the website of poetry, or run:
curl -sSL https://install.python-poetry.org | python3 -
The easiest way to get a working environment set up is using the conda dependency manager, e.g. from here. Replacing with a name of your choice, you can create a conda environment with all dependencies provided using:
conda create --name <env-name> "python==3.11"
Then, activate your environment
conda activate <env-name>
Enter the root directory of the repository (which you should have downloaded with either git clone or the download button above), to install the package.
poetry install
Uninstallation
Uninstallation is possible by typing in the terminal (possibly in the specific virtual environment):
pip uninstall pymaginverse
Tutorial
We have provided four tutorials to make the library easier to use and understand. You can find the jupyter notebooks containing the tutorials in the doc-folder.
The tutorials are:
- Tutorial 1: loading data and running a model. In this Tutorial we show how to load data into the
InputData-class, and teach you the basics of theFieldInversion-class (including several damping types). - Tutorial 2: plotting results. We show some basic plotting tools allowing a better understanding of the created geomagnetic model. Examples consist of residual plots, gauss coefficients, powerspectra, and global magnetic field maps.
- Tutorial 3: sweeping through models. We show how to loop through models with different damping parameters to find a optimal model with the help of the elbow-plot and powerspectra.
- Tutorial 4: loading geomagia dataset. We show how to load a geomagia dataset with our
InputData-class.
All files required for the tutorials are also found in the doc-folder.
Testing
All tests for this library can be found in the test-folder. To run the tests you need to have pytest installed.
After installation of pytest, you can test the code by typing pytest.
Accompanying Article
The Article describing this library can be found here:
Acknowledgements
This Python code is based on a version of Fortran codes that have been spread within the geomagnetic community by personal communication and in its original version were mainly written by David Gubbins, Kathryn Whaler, Jeremy Bloxham, and Andrew Jackson. The authors want to express their gratitude to Sanja Panovska for the fruitful discussions on the algorithm and its spatial and temporal damping options.
Metadata
Release files for pymaginverse 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 3.6 MB
Release files / pymaginverse-1.2.0-cp312-cp312-win_amd64.whl
| Download URL | pymaginverse-1.2.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 96.9 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b485fa6c92f0faeda33ffd9b453df2ddd689798f1800325392e19ed0a5198e62
|
|
BLAKE2b-256 checksum How to use checksums |
03a1b1f86b8073eed5eada73489e93541a87046c928ddce584c7082e52c93ac3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / pymaginverse-1.2.0-cp312-cp312-manylinux_2_39_x86_64.whl
| Download URL | pymaginverse-1.2.0-cp312-cp312-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 493.6 kB |
| Tags | CPython 3.12 Linux glibc 2.39+ x86-64 |
|
SHA-256 checksum How to use checksums |
098f50cd606420c611aced36c8cf9bb7592ff5e371bce66be7ebe037b33c6d44
|
|
BLAKE2b-256 checksum How to use checksums |
5fd7b36349a2207b98f099427f853df93c5a09d8e24cd1ad134c50108e38b0b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / pymaginverse-1.2.0-cp312-cp312-macosx_14_0_arm64.whl
| Download URL | pymaginverse-1.2.0-cp312-cp312-macosx_14_0_arm64.whl |
|---|---|
| Size | 175.2 kB |
| Tags | CPython 3.12 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
6b663f03a6bdff196af4901334a358d47ac87be6d0332d823668380acee4b11a
|
|
BLAKE2b-256 checksum How to use checksums |
c554d3e10b65e7b944befd62e7b663f47794558d620ac4ed4b386f86ff90b9c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / pymaginverse-1.2.0-cp312-cp312-macosx_13_0_x86_64.whl
| Download URL | pymaginverse-1.2.0-cp312-cp312-macosx_13_0_x86_64.whl |
|---|---|
| Size | 175.4 kB |
| Tags | CPython 3.12 macOS 13.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
dbd48b5e830936601407dfc3dc6e135c69fbb7ead14795f110c216b7260fe54a
|
|
BLAKE2b-256 checksum How to use checksums |
9becc9e94466b81910d49f149e3809f06a704b85c0f5702b0fd769d54064a192
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / pymaginverse-1.2.0-cp311-cp311-win_amd64.whl
| Download URL | pymaginverse-1.2.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 96.2 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
15f597bfff52af129b086fa533efd298c33a4010858f12f30039584c61aed929
|
|
BLAKE2b-256 checksum How to use checksums |
d6e18c43c14a0f0f2a4a862515da9dcd0e6747d8532c98c9cd2e136d7ed72d18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / pymaginverse-1.2.0-cp311-cp311-manylinux_2_39_x86_64.whl
| Download URL | pymaginverse-1.2.0-cp311-cp311-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 504.6 kB |
| Tags | CPython 3.11 Linux glibc 2.39+ x86-64 |
|
SHA-256 checksum How to use checksums |
11819f7029c6963a88a4cf41c6d24332a1a1cb0f4df03415ba9fff0e81f768ac
|
|
BLAKE2b-256 checksum How to use checksums |
0e6a037f756441e8fd0366e0ace586cc5757f9483bb5989ac72760d09e85264b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / pymaginverse-1.2.0-cp311-cp311-macosx_14_0_arm64.whl
| Download URL | pymaginverse-1.2.0-cp311-cp311-macosx_14_0_arm64.whl |
|---|---|
| Size | 172.4 kB |
| Tags | CPython 3.11 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
01282c43f04f66a89ee690a46f02be09f67c82ee71b87c8a383dc8f5ea68fe8e
|
|
BLAKE2b-256 checksum How to use checksums |
56fd37d523cc5cf8061e205f1177b988ea0e4098d813f51821dd43f5c0829450
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / pymaginverse-1.2.0-cp311-cp311-macosx_13_0_x86_64.whl
| Download URL | pymaginverse-1.2.0-cp311-cp311-macosx_13_0_x86_64.whl |
|---|---|
| Size | 172.6 kB |
| Tags | CPython 3.11 macOS 13.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
35d34190fa7e4644121dfa0739f76cb30adf026e18102e694670b10b81136243
|
|
BLAKE2b-256 checksum How to use checksums |
381e23612153bf9509849af6d63a5bf04a7dc6b81a7b80c835472c1117a8d1bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / pymaginverse-1.2.0-cp310-cp310-win_amd64.whl
| Download URL | pymaginverse-1.2.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 96.2 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8122fcbae09f6ad1b12c78a401bed53d54b96a84c938ee4d0fedc1dec8cff34a
|
|
BLAKE2b-256 checksum How to use checksums |
a9c9c281bf7093d0e024aa7d3f016e82cba8d5c81f006ea9f371c234e576b141
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / pymaginverse-1.2.0-cp310-cp310-manylinux_2_39_x86_64.whl
| Download URL | pymaginverse-1.2.0-cp310-cp310-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 466.4 kB |
| Tags | CPython 3.10 Linux glibc 2.39+ x86-64 |
|
SHA-256 checksum How to use checksums |
ee83777318667229d7f4491b32c8cb6fb41d21d3b17d1ac575eaad9e0c6be1a8
|
|
BLAKE2b-256 checksum How to use checksums |
bb05f6c83d6f1b9d1ebc1bc42d37927c7cefd43b5d31e749f8b5835f0161a258
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / pymaginverse-1.2.0-cp310-cp310-macosx_14_0_arm64.whl
| Download URL | pymaginverse-1.2.0-cp310-cp310-macosx_14_0_arm64.whl |
|---|---|
| Size | 172.5 kB |
| Tags | CPython 3.10 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
19e9763a9e7490810a4ad111bbfb92f1960f7ad0f88ed661aa1658b6565af71b
|
|
BLAKE2b-256 checksum How to use checksums |
5d4d7ea172e459d5e2febc8d179cb7d2e6f8d96aa890b033e1df518acd2b5826
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / pymaginverse-1.2.0-cp310-cp310-macosx_13_0_x86_64.whl
| Download URL | pymaginverse-1.2.0-cp310-cp310-macosx_13_0_x86_64.whl |
|---|---|
| Size | 102.4 kB |
| Tags | CPython 3.10 macOS 13.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
e40f169283012077d4035319e19dc0674fa5ea1ec15ff58ec0f7c46691a100f5
|
|
BLAKE2b-256 checksum How to use checksums |
4919507dbc2f981cb95a64825f2a1edcad21dfb2694050e184ec922a9a62b7ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / pymaginverse-1.2.0-cp39-cp39-win_amd64.whl
| Download URL | pymaginverse-1.2.0-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 96.7 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
9d66e580d5419a4a7fdbfa5dc45967f09b3db4daa2cfc31bc5811a1a47b5d6d2
|
|
BLAKE2b-256 checksum How to use checksums |
b27d7304120f382986108718bb783ad76936bfb9501cae6f7951da68d2934ece
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / pymaginverse-1.2.0-cp39-cp39-manylinux_2_39_x86_64.whl
| Download URL | pymaginverse-1.2.0-cp39-cp39-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 469.2 kB |
| Tags | CPython 3.9 Linux glibc 2.39+ x86-64 |
|
SHA-256 checksum How to use checksums |
e3d9031abe84163baf269208253e7460e4bef5fa2ce450d1daf64bae8ec4076d
|
|
BLAKE2b-256 checksum How to use checksums |
b774295312bb9ca84cbb5632492534acf19f032dee12fc114483278140f071be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / pymaginverse-1.2.0-cp39-cp39-macosx_14_0_arm64.whl
| Download URL | pymaginverse-1.2.0-cp39-cp39-macosx_14_0_arm64.whl |
|---|---|
| Size | 173.8 kB |
| Tags | CPython 3.9 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b28e1716cfd63de58c1c33d029f667ea8491eed1d4e0c6b4c14064df4ef07538
|
|
BLAKE2b-256 checksum How to use checksums |
534d76c9328b1e75ce26b55f399cb1e3becc21b4715168d6179f05ef2e3dd32d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency logRelease files / pymaginverse-1.2.0-cp39-cp39-macosx_13_0_x86_64.whl
| Download URL | pymaginverse-1.2.0-cp39-cp39-macosx_13_0_x86_64.whl |
|---|---|
| Size | 103.0 kB |
| Tags | CPython 3.9 macOS 13.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
ad84bf8f8b3469015c1e6e31777ec7cb68632952d4e2a1152bc688fc2f18662c
|
|
BLAKE2b-256 checksum How to use checksums |
64ea0514f620750663820eeac77ffabb3bb6ab42e0c750c913048994e61ca57a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 11, 2025.
Transparency log