Package Maintenance
Providing Wheels with Releases
The Continuous Integration (CI) now saves wheels created for each tested Python version and computer Operating System (OS) as artifacts. When preparing a new PyPi release, these wheels may be downloaded from the release candidate. We currently don’t include them, because the wheels only work when the installation environment mirrors the CI environment.
Updating IGRF
The International Geomagnetic Reference Field
is regularly updated to reflect the most recent changes to the Terrestrial
magnetic field. apexpy currently uses IRGF-13 coefficients, which are provided
in the apexpy/apexpy/igrf13coeff.txt
file. To change or update the
magnetic field coefficients used by apexpy, you need to update the python code,
then rerun the fortran program that builds apexpy/apexpy/apexsh.dat
. This
is what makes apexpy performant. For more details, see Emmert et al. [2010] [1].
Assuming your new coefficient file has the same format, the process is simple:
Clone the repository or your fork of the repository (see Contributing).
Update
apexpy/apexpy/apex.py
variableigrf_fn
by setting it equal to the new IGRF coefficient filename (igrf13coeff.txt
, for example).In
apexpy/fortranapex/checkapexsh.f90
, update the variableigrffilein
to the new IGRF coefficent filename. Relative paths are allowed.Modify
checkapexsh.f90
by adding the next 5 year epoch to theepochgrid
variable and updating thenepochgrid
variable as necessary. For example, if the newest IGRF coefficients are good up to 2025 andepochgrid
only has up to the year 2020, then add 2025 toepochgrid
and then incrementnepochgrid
by 1.Execute the
apextest
binary to generate the newapexsh.dat
file.Update the unit tests in the class
TestApexMethodExtrapolateIGRF
inapexpy/apexpy/tests/test_Apex.py
so that they check the methods are working correctly with dates after the latest IGRF epoch (i.e., if the latest epoch is 2020, set the test to initialize with the year 2025). You will have to update the hard-coded confirmation values used by these tests.Commit all changes and create a pull request on GitHub to integrate your branch with updated IGRF into the main repository.
Modifying Fortran Source
When modifying the fortran source code, it can be helpful to run a preliminary
validation of the fortran output independent of the python wrapper. This should
be done within the apexpy/fortranapex
directory.
Remove any existing binaries by running the
make clean
command.Build the
apextest
binary by running themake
command.Execute the
apextext
binary.Confirm the output printed to the screen matches the test output shown in the comment block at the bottom of
checkapexsh.f90
. The output may not match the test output exactly due to floating point errors and improvements in the precision of the calculation.If the modifications involved adding or removing fortran source files, modify the list of extension sources in
setup.cfg
.Rebuild and install apexpy following the instructions in Build from Source.
Updating tests and style standards
apexpy is in the process of updating unit and integration tests to reduce code duplication and implementing cleaner style standards. Additionally, some parts of the fortran code adhere to older coding standards and raise warnings when compiled with newer compilers. If you would like to assist in these efforts (help would be appreciated), please discuss your potential contribution with the current maintainer to ensure a minimal duplication of effort.