Skip to content

Commit

Permalink
Upgrading the Chaos6 model to the latest X5 version.
Browse files Browse the repository at this point in the history
  • Loading branch information
pacesm committed Jun 5, 2018
1 parent 1d3b7ce commit 17f8c8d
Show file tree
Hide file tree
Showing 7 changed files with 934 additions and 39 deletions.
445 changes: 445 additions & 0 deletions eoxmagmod/eoxmagmod/data/CHAOS-6-x4_core.shc

Large diffs are not rendered by default.

445 changes: 445 additions & 0 deletions eoxmagmod/eoxmagmod/data/CHAOS-6-x5_core.shc

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions eoxmagmod/eoxmagmod/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
CHAOS5_STATIC = join(_DIRNAME, 'CHAOS-5_static.shc')
CHAOS6_CORE = join(_DIRNAME, 'CHAOS-6_core.shc')
CHAOS6_CORE_X3 = join(_DIRNAME, 'CHAOS-6-x3_core.shc')
CHAOS6_CORE_X4 = join(_DIRNAME, 'CHAOS-6-x4_core.shc')
CHAOS6_CORE_X5 = join(_DIRNAME, 'CHAOS-6-x5_core.shc')
CHAOS6_CORE_LATEST = CHAOS6_CORE_X5
CHAOS6_STATIC = join(_DIRNAME, 'CHAOS-6_static.shc')
IGRF11 = join(_DIRNAME, 'igrf11coeffs.txt')
IGRF12 = join(_DIRNAME, 'IGRF12.shc')
Expand Down
17 changes: 5 additions & 12 deletions eoxmagmod/eoxmagmod/magnetic_model/tests/coefficient_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from eoxmagmod._pytimeconv import decimal_year_to_mjd2000
from eoxmagmod.data import (
CHAOS5_CORE, CHAOS5_CORE_V4, CHAOS5_STATIC,
CHAOS6_CORE, CHAOS6_CORE_X3, CHAOS6_STATIC,
CHAOS6_CORE_LATEST, CHAOS6_STATIC,
IGRF11, IGRF12, SIFM, WMM_2010, WMM_2015,
EMM_2010_STATIC, EMM_2010_SECVAR,
)
Expand Down Expand Up @@ -219,16 +219,9 @@ class TestCoeffCHAOS5Combined(TestCase, CombinedShcTestMixIn):

class TestCoeffCHAOS6Core(TestCase, ShcTestMixIn):
class_ = SparseSHCoefficientsTimeDependentDecimalYear
path = CHAOS6_CORE
path = CHAOS6_CORE_LATEST
degree = 20
validity = decimal_year_to_mjd2000((1997.102, 2016.6023))


class TestCoeffCHAOS6CoreX3(TestCase, ShcTestMixIn):
class_ = SparseSHCoefficientsTimeDependentDecimalYear
path = CHAOS6_CORE_X3
degree = 20
validity = decimal_year_to_mjd2000((1997.102, 2017.6016))
validity = decimal_year_to_mjd2000((1997.102, 2018.1013))


class TestCoeffCHAOS6Static(TestCase, ShcTestMixIn):
Expand All @@ -239,10 +232,10 @@ class TestCoeffCHAOS6Static(TestCase, ShcTestMixIn):


class TestCoeffCHAOS6Combined(TestCase, CombinedShcTestMixIn):
path_core = CHAOS6_CORE_X3
path_core = CHAOS6_CORE_LATEST
path_static = CHAOS6_STATIC
degree = 110
validity = decimal_year_to_mjd2000((1997.1020, 2017.6016))
validity = decimal_year_to_mjd2000((1997.1020, 2018.1013))

#-------------------------------------------------------------------------------

Expand Down
29 changes: 11 additions & 18 deletions eoxmagmod/eoxmagmod/magnetic_model/tests/model_loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
from eoxmagmod.data import (
EMM_2010_STATIC, EMM_2010_SECVAR, WMM_2010, WMM_2015,
CHAOS5_CORE, CHAOS5_CORE_V4, CHAOS5_STATIC,
CHAOS6_CORE, CHAOS6_CORE_X3, CHAOS6_STATIC,
CHAOS6_CORE_LATEST, CHAOS6_STATIC,
IGRF11, IGRF12, SIFM,
)
from eoxmagmod.magnetic_model.tests.data import (
Expand Down Expand Up @@ -219,6 +219,10 @@ def test_eval_multi_time_invalid(self):

def test_eval_reference_values(self):
times, coords, results = self.reference_values
try:
assert_allclose(self.eval_model(times, coords), results)
except:
print tuple(float(f) for f in self.eval_model(times, coords))
assert_allclose(self.eval_model(times, coords), results)

def test_eval_empty_coords(self):
Expand Down Expand Up @@ -408,34 +412,23 @@ def load(self):
class TestCHAOS6Core(TestCase, SHModelTestMixIn):
reference_values = (
2503.33, (30.0, 40.0, 8000.0),
(15127.146281343608, 318.51792709726175, -14493.952978715943)
(15127.120635596926, 318.5338195336121, -14493.87226290503)
)
validity = decimal_year_to_mjd2000((1997.102, 2016.6023))
validity = decimal_year_to_mjd2000((1997.102, 2018.1013))

def load(self):
return load_model_shc(CHAOS6_CORE)


class TestCHAOS6CoreX3(TestCase, SHModelTestMixIn):
reference_values = (
2685.9, (30.0, 40.0, 8000.0),
(15127.196090133599, 328.5862052582883, -14503.664172833218)
)
validity = decimal_year_to_mjd2000((1997.102, 2017.6016))

def load(self):
return load_model_shc(CHAOS6_CORE_X3)
return load_model_shc(CHAOS6_CORE_LATEST)


class TestCHAOS6Combined(TestCase, SHModelTestMixIn):
reference_values = (
2685.9, (30.0, 40.0, 8000.0),
(15127.189344364127, 328.594809830505, -14503.674668221536)
(15127.166976516573, 328.59358581354275, -14503.61324922254)
)
validity = decimal_year_to_mjd2000((1997.102, 2017.6016))
validity = decimal_year_to_mjd2000((1997.102, 2018.1013))

def load(self):
return load_model_shc_combined(CHAOS6_CORE_X3, CHAOS6_STATIC)
return load_model_shc_combined(CHAOS6_CORE_LATEST, CHAOS6_STATIC)

#-------------------------------------------------------------------------------

Expand Down
23 changes: 22 additions & 1 deletion eoxmagmod/eoxmagmod/magnetic_model/tests/parser_shc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
from eoxmagmod.magnetic_model.parser_shc import parse_shc_file
from eoxmagmod.data import (
CHAOS5_CORE, CHAOS5_CORE_V4, CHAOS5_STATIC,
CHAOS6_CORE, CHAOS6_CORE_X3, CHAOS6_STATIC,
CHAOS6_CORE, CHAOS6_CORE_X3, CHAOS6_CORE_X4, CHAOS6_CORE_X5,
CHAOS6_STATIC,
IGRF12, SIFM,
)

Expand Down Expand Up @@ -94,6 +95,26 @@ def test_parse_shc_file_chaos6core_x3(self):
"nstep": 5,
})

def test_parse_shc_file_chaos6core_x4(self):
data = self.parse(CHAOS6_CORE_X4)
self._assert_valid(data, {
"degree_min": 1,
"degree_max": 20,
"spline_order": 6,
"ntime": 211,
"nstep": 5,
})

def test_parse_shc_file_chaos6core_x5(self):
data = self.parse(CHAOS6_CORE_X5)
self._assert_valid(data, {
"degree_min": 1,
"degree_max": 20,
"spline_order": 6,
"ntime": 211,
"nstep": 5,
})

def test_parse_shc_file_chaos6static(self):
data = self.parse(CHAOS6_STATIC)
self._assert_valid(data, {
Expand Down
11 changes: 3 additions & 8 deletions eoxmagmod/eoxmagmod/tests/magnetic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from eoxmagmod.shc import read_model_shc
from eoxmagmod.data import (
CHAOS5_CORE, CHAOS5_CORE_V4, CHAOS5_STATIC,
CHAOS6_CORE, CHAOS6_CORE_X3, CHAOS6_STATIC,
CHAOS6_CORE_LATEST, CHAOS6_STATIC,
IGRF12, SIFM,
)
from eoxmagmod._pywmm import (
Expand Down Expand Up @@ -144,13 +144,8 @@ class TestCHAOS6Static(TestCase, MagneticModelMixIn):


class TestCHAOS6Core(TestCase, MagneticModelMixIn):
validity = (1997.102, 2016.6023)
model = read_model_shc(CHAOS6_CORE)


class TestCHAOS6CoreX3(TestCase, MagneticModelMixIn):
validity = (1997.102, 2017.6016)
model = read_model_shc(CHAOS6_CORE_X3)
validity = (1997.102, 2018.1013)
model = read_model_shc(CHAOS6_CORE_LATEST)

#-------------------------------------------------------------------------------

Expand Down

0 comments on commit 17f8c8d

Please sign in to comment.