Pymaginverse: A python package for global geomagnetic field modeling

Frenk Out*, Maximilian Schanner, Liz van Grinsven, Monika Korte, Lennart V. de Groot

*Corresponding author for this work

Research output: Contribution to journalArticleAcademicpeer-review

Abstract

Data-based geomagnetic models are key for mapping the global field, predicting the movement of magnetic poles, understanding the complex processes happening in the outer core, and describing the global expression of magnetic field reversals. There exists a wide range of models, which differ in a priori assumptions and methods for spatio-temporal interpolation. A frequently used modeling procedure is based on regularized least squares (RLS) spherical harmonic analysis, which has been used since the 1980s. The first version of this algorithm has been written in Fortran and inspired many different research groups to produce versions of the algorithm in other programming languages, either published open-access or only accessible within the institute. To open up the research field and allow for reproducibility of results between existing versions, we provide a user-friendly open-source Python version of this popular algorithm. We complement this method with an overview on background literature – concerning Maxwells equations, spherical harmonics, cubic B-Splines, and regularization – that forms the basis for RLS geomagnetic models. We included six spatial and two temporal damping methods from literature to further smooth the magnetic field in space and time. Computational resources are kept to a minimum by employing the banded structure of the normal equations involved and incorporating C-code (with Cython) for matrix formation, enabling a massive speed-up. This ensures that the algorithm can be executed on a simple laptop, and is as fast as its Fortran predecessor. Four tutorials with ample examples show how to employ the new lightweight and quick algorithm. With this properly documented open-source Python algorithm, we have the intention to encourage current and new users to employ and further develop the method.
Original languageEnglish
Article number100222
JournalApplied Computing and Geosciences
Volume25
DOIs
Publication statusPublished - Feb 2025

Bibliographical note

Publisher Copyright:
© 2025 The Authors

Funding

The presented Python code is based on a variety 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. This project has received funding from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation program (Grant agreement No. 851460 to L.V. de Groot). This project is also funded by the Dutch Science Foundation (NWO) VIDI grant VI.Vidi.192.047 to L.V. de Groot. M.S. received funding from the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation), Grant 388291411. The presented Python code is based on a variety 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. This project has received funding from the European Research Council (ERC) under the European Union\u2019s Horizon 2020 research and innovation program (Grant agreement No. 851460 to L.V. de Groot). This project is also funded by the Dutch Science Foundation (NWO) VIDI grant VI.Vidi.192.047 to L.V. de Groot. M.S. received funding from the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) , Grant 388291411 .

FundersFunder number
Andrew Jackson
European Research Council
Horizon 2020
Horizon 2020 Framework Programme851460
Nederlandse Organisatie voor Wetenschappelijk OnderzoekVI.Vidi.192.047
Deutsche Forschungsgemeinschaft388291411

    Keywords

    • Geomagia
    • Open research
    • Paleomagnetism
    • RLS geomagnetic models

    Fingerprint

    Dive into the research topics of 'Pymaginverse: A python package for global geomagnetic field modeling'. Together they form a unique fingerprint.

    Cite this