Skip to content

Commit

Permalink
Switching to IRGF13 in the SHC format.
Browse files Browse the repository at this point in the history
  • Loading branch information
pacesm committed Jan 18, 2020
1 parent 4766db7 commit f1c4c0e
Show file tree
Hide file tree
Showing 8 changed files with 226 additions and 219 deletions.
200 changes: 200 additions & 0 deletions eoxmagmod/eoxmagmod/data/IGRF13.shc

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion eoxmagmod/eoxmagmod/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
CHAOS_CORE_LATEST = CHAOS7_CORE_LATEST
IGRF11 = join(_DIRNAME, 'igrf11coeffs.txt')
IGRF12 = join(_DIRNAME, 'IGRF12.shc')
IGRF13 = join(_DIRNAME, 'igrf13coeffs.txt')
IGRF13 = join(_DIRNAME, 'IGRF13.shc')
SIFM = join(_DIRNAME, 'SIFM.shc')
LCS1 = join(_DIRNAME, 'LCS-1.shc')
MF7 = join(_DIRNAME, 'MF7.shc')
Expand Down
199 changes: 0 additions & 199 deletions eoxmagmod/eoxmagmod/data/igrf13coeffs.txt

This file was deleted.

6 changes: 6 additions & 0 deletions eoxmagmod/eoxmagmod/magnetic_model/loader_igrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@

def load_model_igrf(path):
""" Load model from an IGRF coefficient file.
This loader can be used load to load the models in the original IGRF
coefficient file format.
Starting by IGRF12, the eoxmagmod package contains IGRF models
converted to the common SHC format which are loaded by the SHC file loader.
"""
return SphericalHarmomicGeomagneticModel(load_coeff_igrf(path))

Expand Down
14 changes: 6 additions & 8 deletions eoxmagmod/eoxmagmod/magnetic_model/tests/coefficient_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
from unittest import TestCase, main
from numpy import inf
from numpy.testing import assert_allclose
from eoxmagmod.time_util import (
decimal_year_to_mjd2000, decimal_year_to_mjd2000_simple,
)
from eoxmagmod.time_util import decimal_year_to_mjd2000
from eoxmagmod.data import (
CHAOS6_CORE_LATEST, CHAOS6_STATIC,
CHAOS7_CORE_LATEST, CHAOS7_STATIC,
Expand Down Expand Up @@ -186,16 +184,16 @@ class TestCoeffSIFM(TestCase, ShcTestMixIn):
validity = decimal_year_to_mjd2000((2013.4976, 2015.4962))


class TestCoeffIGRF13(TestCase, CoefficietLoaderTestMixIn):
class TestCoeffIGRF13(TestCase, ShcTestMixIn):
class_ = SparseSHCoefficientsTimeDependentDecimalYear
path = IGRF13
degree = 13
min_degree = 1
kwargs = {
"interpolate_in_decimal_years": True,
}
validity = decimal_year_to_mjd2000((1900.0, 2025.0))

@staticmethod
def load():
return load_coeff_igrf(IGRF13)


class TestCoeffIGRF12(TestCase, ShcTestMixIn):
class_ = SparseSHCoefficientsTimeDependentDecimalYear
Expand Down
3 changes: 1 addition & 2 deletions eoxmagmod/eoxmagmod/magnetic_model/tests/model_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,7 @@ class TestIGRF13(TestCase, SHModelTestMixIn):
validity = decimal_year_to_mjd2000((1900.0, 2025.0))

def load(self):
return load_model_igrf(IGRF13)

return load_model_shc(IGRF13, interpolate_in_decimal_years=True)

class TestSIFM(TestCase, SHModelTestMixIn):
reference_values = (
Expand Down
9 changes: 1 addition & 8 deletions eoxmagmod/eoxmagmod/magnetic_model/tests/parser_igrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from unittest import TestCase, main
from numpy import abs as aabs
from eoxmagmod.magnetic_model.parser_igrf import parse_igrf_file
from eoxmagmod.data import IGRF11, IGRF13
from eoxmagmod.data import IGRF11


class TestIGRFParser(TestCase):
Expand Down Expand Up @@ -60,13 +60,6 @@ def test_parse_igrf_file_igrf11(self):
"degree_max": 13,
})

def test_parse_igrf_file_igrf13(self):
data = self.parse(IGRF13)
self._assert_valid(data, {
"degree_min": 1,
"degree_max": 13,
})


if __name__ == "__main__":
main()
12 changes: 11 additions & 1 deletion eoxmagmod/eoxmagmod/magnetic_model/tests/parser_shc.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from eoxmagmod.data import (
CHAOS6_CORE_LATEST, CHAOS6_STATIC,
CHAOS7_CORE_LATEST, CHAOS7_STATIC,
IGRF12, SIFM, LCS1, MF7,
IGRF12, IGRF13, SIFM, LCS1, MF7,
)


Expand Down Expand Up @@ -94,6 +94,16 @@ def test_parse_shc_file_igrf12(self):
"nstep": 1,
})

def test_parse_shc_file_igrf13(self):
data = self.parse(IGRF13)
self._assert_valid(data, {
"degree_min": 1,
"degree_max": 13,
"spline_order": 2,
"ntime": 26,
"nstep": 1,
})

def test_parse_shc_header_igrf12(self):
self._test_header(IGRF12)

Expand Down

0 comments on commit f1c4c0e

Please sign in to comment.