Frenk Out , Maximilian Schanner , Liz van Grinsven , Monika Korte , Lennart V. de Groot
{"title":"Pymaginverse: A python package for global geomagnetic field modeling","authors":"Frenk Out , Maximilian Schanner , Liz van Grinsven , Monika Korte , Lennart V. de Groot","doi":"10.1016/j.acags.2025.100222","DOIUrl":null,"url":null,"abstract":"<div><div>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.</div></div>","PeriodicalId":33804,"journal":{"name":"Applied Computing and Geosciences","volume":"25 ","pages":"Article 100222"},"PeriodicalIF":2.6000,"publicationDate":"2025-02-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Applied Computing and Geosciences","FirstCategoryId":"1085","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S2590197425000047","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q2","JCRName":"COMPUTER SCIENCE, INTERDISCIPLINARY APPLICATIONS","Score":null,"Total":0}
引用次数: 0
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.