The wmm package calculates magnetic field at a given location and time according to the World Magnetic Model.
This package has 1 exported function, GetMagneticFieldWMM, which returns a list of:
Main field and secular variation vector components in nT and nT/yr, resp.
Magnetic element intensities (i.e., horizontal and total intensities, h & f) in nT with their secular variation in nT/yr
Magnetic element angles (i.e., inclination and declination, i & d) in degrees with their secular variation in deg/yr
GetMagneticFieldWMM(lambda_t, phi_t, h_t, t) = (x, y, z, xDot, yDot, zDot, h, f, i, d, hDot, fDot, iDot, dDot)
Thanks to:
The WMM team past, present, and future for making the Gauss coefficients public domain
Alex Breeze for tech reviewing the original version of this code, years ago