clean Python interface to Apex without f2py--compute millions of points per second on laptop.
ApexPy3 will build automatically using CMake on the first run. As usual with Python packages, install in development mode by:
pip install -e .
or
python setup.py develop --user
Typically, users would input Numpy ndarray of arbitrary dimension and shape. There is a fixed setup time for Apex of 5-10 seconds, but then it only takes about 100 ns per point. Thus it behooves the user to feed in a large array of points once, rather than call repeatedly.
import apexpy3
dat = apexpy3.geo2mag(yeardec=2018.5, glat=40, glon=-105)
print(dat)
{'gmlat': array([47.7939873]), 'gmlon': array([-37.5895653])}
Just to show raw Fortran speed
./build/apex_benchmark 40. 25. 2020.
coordinate conversion (geographic to geomag) ~ 100 ns per point on modest laptop with Gfortran or Intel oneAPI.