Applied Computing and Geosciences (Feb 2025)

Pymaginverse: A python package for global geomagnetic field modeling

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

Journal volume & issue
Vol. 25
p. 100222

Abstract

Read online

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.

Keywords