Package Maintenance¶
Updating IGRF¶
The International Geomagnetic Reference Field
is regularly updated to reflect the most recent changes to the Terrestrial
magnetic field. AACGMV2 currently uses IRGF-14 coefficients, which are provided
in the aacgmv2/aacgmv2/igrf14coeff.txt file and a combined magnetic model
that uses coefficients provided in aacgmv2/aacgmv2/magmodel_1590-2025.txt.
To change or update the magnetic field coefficients used by AACGMV2, you need to
obtain the new IGRF coefficients, magnetic model coefficients, and the AACGMV2
coefficients, and update the Python and C code. If substantial changes have been
made to the C code, it may be necessary to update the functions in
aacgmv2/aacgmv2/aacgmv2module.c, as this is what allows Python to interface
with the AACGMV2 source code. Updates to the AACGMV2 coefficients and code may
be obtained from the website hosted by
Dartmouth. The C tarball
contains the IGRF and magnetic model coefficient files.
Assuming no changes were made to the way coefficients are handled or the C code is called, the updating process is simple:
Clone the repository or update your fork of the repository (see Contributing).
Replace the AACGMV2 coefficients in
aacgmv2/aacgmv2/aacgm_coeffs.Replace the IGRF coefficient file in
aacgmv2/aacgmv2/.Update the
aacgmv2/__init__.pyglobal variablesAACGM_v2_DAT_PREFIXandIGRF_COEFFFSIf the C code has been updated, update the
c_aacgmv2/README.txt,c_aacgmv2/release_notes.txt, andLISCENCE-AstAlg.txtfiles for the new version.If the C code has been updated, update the header files in
c_aacgmv2/include. Check to see if any files have been removed. Ifc_aacgmv2/include/astalg.hends up removing theM_PIdefinition, add it back in (needed for Windows).If the C code has been updated, update the source files in
c_aacgmv2/src. Check to see if any files have been removed; remove them from the list ofaacgmv2/setup.pysources. If theNANandisfinitedefinitions are removed frommlt_v2.cand theEINVALdefinition andsetenvfunction are removed fromrtime.c, add these and the header info back in (needed for Windows). Also, fix the commenting style intest_aacgm.cto reduce compiler warnings.Rebuild and install AACGMV2 following the instructions in Installation.
Update the unit tests in the
aacgmv2/aacgmv2/tests/directory so that they check the functions are working correctly with dates after the IGRF epoch update. You will have to update the hard-coded confirmation values used by these tests, but the values should not change by more than a hundredth of a degree. Tests that may need to be updated include:test_c_aacgmv2.py::TestCAACGMV2.test_converttest_cmd_aacgmv2.py::TestCmdAACGMV2::test_convert_stdin_stdouttest_cmd_aacgmv2.py::TestCmdAACGMV2::test_convert_mlt_stdin_stdouttest_struct_aacgmv2.py::TestTopVariables::test_top_parameterstest_utils_aacgmv2.py::TestUtilsAACGMV2::test_igrf_dipole_axisenviron/test_environ_aacgmv2.py::TestPyEnviron
Commit all changes and create a pull request on GitHub to integrate your branch with updated IGRF into the main repository.
Modifying the C Source¶
When modifying the C source code, it can be helpful to run a preliminary
validation of the C output independent of the Python wrapper. This should
be done within the aacgmv2/c_aacgmv2 directory.
Build the
test_aacgmbinary by following the instructions inaacgmv2/c_aacgmv2/README.txt. You will have to alter the compilation command to preface each.cfile withsrcand also add-Iinclude.
Execute the
test_aacgmbinary.Confirm the output printed to the screen matches the test output shown in the comment block provided in the
aacgmv2/c_aacgmv2/README.txt.If the modifications involved adding or removing C source files, modify the list of extension sources in
setup.py.Rebuild and install AACGMV2 following the instructions in Installation.