- 1Paleomagnetic laboratory Fort Hoofddijk, Department of Earth Sciences, Utrecht University, Utrecht, The Netherlands. (outfrenk@gmail.com)
- 2Institute of applied mathematics, Potsdam University, Potsdam, Germany
- 3Helmholtz Centre Potsdam, Deutsches GeoForschungsZentrum GFZ, Telegrafenberg, Potsdam, Germany
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 the interpolation of data in space and time. A frequently used modeling procedure is based on regularized least squares (RLS) spherical harmonic analysis, which has been used since the 1980s. This technique minimizes the error between modeled observations and data while constraining the model to realistic values, although some of these constraints have (partially) lost their physical foundation.
The first version of this algorithm has been written in Fortran and led 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 the RLS algorithm accompanied by six spatial and two temporal damping methods from literature to enforce a spatially and temporally realistic magnetic field. We also provide a comprehensive discussion of key background concepts - concerning Maxwells equations, spherical harmonics, cubic B-Splines, and regularization – for a deeper understanding of the theoretical foundation of RLS geomagnetic models.
While Python is known for its readability, it is often criticized for its high overhead costs. We addressed this issue by leveraging the banded structure of the normal equations and incorporating C-code (via Cython) for matrix operations, significantly improving speed. As a result, the algorithm can run on a standard laptop with performance comparable to its Fortran predecessor. We show how to employ the new lightweight and quick algorithm with ample examples from our four included tutorials. With this well-documented open-source Python version, we aim to encourage both existing and new users to create their own geomagnetic models and further advance the method.
How to cite: Out, F., Schanner, M., van Grinsven, L., Korte, M., and de Groot, L.: pymaginverse: a python package for global geomagnetic field modeling, EGU General Assembly 2025, Vienna, Austria, 27 Apr–2 May 2025, EGU25-18949, https://doi.org/10.5194/egusphere-egu25-18949, 2025.