def test_callable_all_zero(self):
     coeff, degree = self.eval_coeff(decimal_year_to_mjd2000(2018.5),
                                     min_degree=3)
     assert_allclose(coeff, [
         [0, 0],
     ])
     self.assertEqual(degree, 0)
示例#2
0
class TestCHAOS6CoreWithOverridenValidity(TestCHAOS6Core):
    validity = decimal_year_to_mjd2000((2000.0, 2018.0))

    def load(self):
        return load_model_shc(CHAOS6_CORE_LATEST,
                              validity_start=2000.0,
                              validity_end=2018.0)
class TestCHAOS7CombinedOverridenValidity(TestCHAOS7Combined):
    validity = decimal_year_to_mjd2000((2000.0, 2018.0))

    def load(self):
        return load_model_shc_combined(
            CHAOS7_CORE_LATEST, CHAOS7_STATIC,
            validity_start=2000.0, validity_end=2018.0
        )
示例#4
0
class TestCoeffIGRF12(TestCase, ShcTestMixIn):
    class_ = SparseSHCoefficientsTimeDependentDecimalYear
    path = IGRF12
    degree = 13
    kwargs = {
        "interpolate_in_decimal_years": True,
    }
    validity = decimal_year_to_mjd2000((1900.0, 2020.0))
 def test_callable_all_zero(self):
     coeff, degree = self.eval_coeff(
         decimal_year_to_mjd2000(2018.5), min_degree=3
     )
     assert_allclose(coeff, [
         [0, 0],
     ])
     self.assertEqual(degree, 0)
 def test_callable(self):
     coeff, degree = self.eval_coeff(decimal_year_to_mjd2000(2018.5))
     assert_allclose(coeff, [
         (0, 0),
         (-1.44080531, 0), (-0.27711333, -0.25918073),
         (-0.63645813, 0), (-0.22583255, -2.02305245), (0.05941826, -0.24358544),
     ], atol=1e-8)
     self.assertEqual(degree, self.degree)
示例#7
0
class TestCoeffEMM2010(TestCase, CoefficietLoaderTestMixIn):
    class_ = CombinedSHCoefficients
    degree = 739
    validity = decimal_year_to_mjd2000((2010.0, 2015.0))

    @staticmethod
    def load():
        return load_coeff_emm(EMM_2010_STATIC, EMM_2010_SECVAR)
 def test_callable(self):
     coeff, degree = self.eval_coeff(decimal_year_to_mjd2000(2018.5))
     assert_allclose(coeff, [
         (0, 0),
         (0.11415226, 0), (-0.22361224, -0.02624283),
         (-0.23244221, 0), (-0.34379927, -0.81524805), (0.01412196, -0.18049787),
     ], atol=1e-8)
     self.assertEqual(degree, self.degree)
示例#9
0
class TestCoeffSIFM(TestCase, ShcTestMixIn):
    class_ = SparseSHCoefficientsTimeDependentDecimalYear
    path = SIFM
    degree = 70
    kwargs = {
        "interpolate_in_decimal_years": True,
    }
    validity = decimal_year_to_mjd2000((2013.4976, 2015.4962))
示例#10
0
class TestCoeffIGRF11(TestCase, CoefficietLoaderTestMixIn):
    class_ = SparseSHCoefficientsTimeDependentDecimalYear
    degree = 13
    validity = decimal_year_to_mjd2000((1900.0, 2015.0))

    @staticmethod
    def load():
        return load_coeff_igrf(IGRF11)
示例#11
0
 def test_callable_min_max_degree(self):
     coeff, degree = self.eval_coeff(
         decimal_year_to_mjd2000(2018.5), max_degree=1, min_degree=1
     )
     assert_allclose(coeff, [
         (0, 0),
         (0.11415226, 0), (-0.22361224, -0.02624283),
     ], atol=1e-8)
     self.assertEqual(degree, 1)
示例#12
0
class TestCHAOS6Core(TestCase, SHModelTestMixIn):
    reference_values = (2503.33, (30.0, 40.0, 8000.0),
                        (15127.112741712719, 318.52904189382974,
                         -14493.826457120203))
    degree = 20
    validity = decimal_year_to_mjd2000((1997.102, 2019.1006))

    def load(self):
        return load_model_shc(CHAOS6_CORE_LATEST)
示例#13
0
class TestCHAOS5CoreV4(TestCase, SHModelTestMixIn):
    reference_values = (2411.9, (30.0, 40.0, 8000.0),
                        (15127.03768745214, 313.61814829613326,
                         -14489.207459734534))
    degree = 20
    validity = decimal_year_to_mjd2000((1997.1020, 2016.1027))

    def load(self):
        return load_model_shc(CHAOS5_CORE_V4)
示例#14
0
class TestSIFM(TestCase, SHModelTestMixIn):
    reference_values = (5295.36, (30.0, 40.0, 8000.0),
                        (15122.448070753977, 474.14615304317635,
                         -14669.16289251053))
    degree = 70
    validity = decimal_year_to_mjd2000((2013.4976, 2015.4962))

    def load(self):
        return load_model_shc(SIFM)
示例#15
0
class TestIGRF12(TestCase, SHModelTestMixIn):
    reference_values = (-15522.5, (30.0, 40.0, 8000.0),
                        (15259.57386772841, -159.00767967612023,
                         -14015.952721753336))
    degree = 13
    validity = decimal_year_to_mjd2000((1900.0, 2020.0))

    def load(self):
        return load_model_shc(IGRF12, interpolate_in_decimal_years=True)
示例#16
0
class TestIGRF11(TestCase, SHModelTestMixIn):
    reference_values = (-14609.5, (30.0, 40.0, 8000.0),
                        (15265.918081037888, -142.6442876878355,
                         -14044.282413158882))
    degree = 13
    validity = decimal_year_to_mjd2000((1900.0, 2015.0))

    def load(self):
        return load_model_igrf(IGRF11)
示例#17
0
class TestWMM2015(TestCase, SHModelTestMixIn):
    reference_values = (6392.0, (30.0, 40.0, 8000.0),
                        (15124.716592471135, 533.1027023540182,
                         -14728.4938691708))
    degree = 12
    validity = decimal_year_to_mjd2000((2015.0, 2020.0))

    def load(self):
        return load_model_wmm(WMM_2015)
示例#18
0
class TestCHAOS6Combined(TestCase, SHModelTestMixIn):
    reference_values = (2685.9, (30.0, 40.0, 8000.0),
                        (15127.164745882454, 328.584740011225,
                         -14503.5849807797))
    degree = 110
    validity = decimal_year_to_mjd2000((1997.102, 2019.1006))

    def load(self):
        return load_model_shc_combined(CHAOS6_CORE_LATEST, CHAOS6_STATIC)
 def test_callable_max_degree(self):
     coeff, degree = self.eval_coeff(decimal_year_to_mjd2000(2018.5),
                                     max_degree=1)
     assert_allclose(coeff, [
         (0, 0),
         (0.11415226, 0),
         (-0.22361224, -0.02624283),
     ],
                     atol=1e-8)
     self.assertEqual(degree, 1)
示例#20
0
class TestWMM2010(TestCase, SHModelTestMixIn):
    reference_values = (4566.0, (30.0, 40.0, 8000.0),
                        (15123.605974201277, 431.1067254253052,
                         14617.02644010297))
    degree = 12
    validity = decimal_year_to_mjd2000((2010.0, 2015.0))
    options = {"scale": [1, 1, -1]}
    scale = [1, 1, -1]

    def load(self):
        return load_model_wmm(WMM_2010)
class TestCHAOS7Core(TestCase, SHModelTestMixIn):
    reference_values = (
        2503.33, (30.0, 40.0, 8000.0),
        (15127.045139657823, 318.50032374650084, -14493.825323293026)
    )
    degree = 20
    min_degree = 1
    validity = decimal_year_to_mjd2000((1997.102, 2020.3036))

    def load(self):
        return load_model_shc(CHAOS7_CORE_LATEST)
class TestCHAOS7Combined(TestCase, SHModelTestMixIn):
    reference_values = (
        2685.9, (30.0, 40.0, 8000.0),
        (15127.12453561178, 328.5699830229952, -14503.561841084533)
    )
    degree = 185
    min_degree = 1
    validity = decimal_year_to_mjd2000((1997.102, 2020.3036))

    def load(self):
        return load_model_shc_combined(CHAOS7_CORE_LATEST, CHAOS7_STATIC)
class TestCHAOS6Combined(TestCase, SHModelTestMixIn):
    reference_values = (
        2685.9, (30.0, 40.0, 8000.0),
        (15126.846514889372, 328.6152387760897, -14503.41320342751)
    )
    degree = 110
    min_degree = 1
    validity = decimal_year_to_mjd2000((1997.102, 2019.7002))

    def load(self):
        return load_model_shc_combined(CHAOS6_CORE_LATEST, CHAOS6_STATIC)
class TestCHAOS6Core(TestCase, SHModelTestMixIn):
    reference_values = (
        2503.33, (30.0, 40.0, 8000.0),
        (15126.82943355118, 318.5424866747154, -14493.674497808082)
    )
    degree = 20
    min_degree = 1
    validity = decimal_year_to_mjd2000((1997.102, 2019.7002))

    def load(self):
        return load_model_shc(CHAOS6_CORE_LATEST)
class TestWMM2015(TestCase, SHModelTestMixIn):
    reference_values = (
        6392.0, (30.0, 40.0, 8000.0),
        (15124.421927514817, 532.3321104099762, -14755.455538253298)
    )
    degree = 12
    min_degree = 1
    validity = decimal_year_to_mjd2000((2015.0, 2020.0))

    def load(self):
        return load_model_wmm(WMM_2015)
 def test_callable(self):
     coeff, degree = self.eval_coeff(decimal_year_to_mjd2000(2018.5))
     assert_allclose(coeff, [
         (0, 0),
         (-1.44080531, 0),
         (-0.27711333, -0.25918073),
         (-0.63645813, 0),
         (-0.22583255, -2.02305245),
         (0.05941826, -0.24358544),
     ],
                     atol=1e-8)
     self.assertEqual(degree, self.degree)
 def test_callable(self):
     coeff, degree = self.eval_coeff(decimal_year_to_mjd2000(2018.5))
     assert_allclose(coeff, [
         (0, 0),
         (0.11415226, 0),
         (-0.22361224, -0.02624283),
         (-0.23244221, 0),
         (-0.34379927, -0.81524805),
         (0.01412196, -0.18049787),
     ],
                     atol=1e-8)
     self.assertEqual(degree, self.degree)
示例#28
0
class TestEMM2010(TestCase, SHModelTestMixIn):
    reference_values = (4566.0, (30.0, 40.0, 8000.0),
                        (15124.606019372684, 442.2376840179962,
                         -14612.282120230499))
    # The EMM models is huge and the test ranges have to be reduced.
    range_lat = range(-90, 91, 30)
    range_lon = range(-180, 181, 60)
    degree = 739
    validity = decimal_year_to_mjd2000((2010.0, 2015.0))
    options = {"max_degree": 300}

    def load(self):
        return load_model_emm(EMM_2010_STATIC, EMM_2010_SECVAR)
示例#29
0
 def test_extra_sub_solar_point(self):
     coeff, degree = self.eval_coeff(
         decimal_year_to_mjd2000(2018.5), lat_sol=0.0, lon_sol=0.0,
     )
     assert_allclose(coeff, [
         (0.0, 0.0),
         (0.12120376078924046, 0.0),
         (-0.22660807757361834, 0.008720797143766132),
         (-0.2485487953382298, 0.0),
         (-0.40755502000159416, -0.7608326017305439),
         (-0.04181600178841578, -0.16655581670562275),
     ], atol=1e-8)
     self.assertEqual(degree, self.degree)
 def test_extra_sub_solar_point(self):
     coeff, degree = self.eval_coeff(
         decimal_year_to_mjd2000(2018.5),
         lat_sol=0.0,
         lon_sol=0.0,
     )
     assert_allclose(coeff, [
         (0.0, 0.0),
         (0.12120376078924046, 0.0),
         (-0.22660807757361834, 0.008720797143766132),
         (-0.2485487953382298, 0.0),
         (-0.40755502000159416, -0.7608326017305439),
         (-0.04181600178841578, -0.16655581670562275),
     ],
                     atol=1e-8)
     self.assertEqual(degree, self.degree)
示例#31
0
 def _constrain_validity(time_min, time_max):
     return (
         max(time_min, decimal_year_to_mjd2000(1920)),
         min(time_max, decimal_year_to_mjd2000(2120)),
     )
class TestCoeffWMM2015(TestCase, WmmTestMixIn):
    class_ = SparseSHCoefficientsTimeDependentDecimalYear
    path = WMM_2015
    degree = 12
    min_degree = 1
    validity = decimal_year_to_mjd2000((2015., 2020.))
class TestCoeffCHAOS6Combined(TestCase, CombinedShcTestMixIn):
    path_core = CHAOS6_CORE_LATEST
    path_static = CHAOS6_STATIC
    degree = 110
    min_degree = 1
    validity = decimal_year_to_mjd2000((1997.1020, 2019.7002))
class TestCoeffCHAOS6Core(TestCase, ShcTestMixIn):
    class_ = SparseSHCoefficientsTimeDependent
    path = CHAOS6_CORE_LATEST
    degree = 20
    min_degree = 1
    validity = decimal_year_to_mjd2000((1997.102, 2019.7002))
 def _constrain_validity(time_min, time_max):
     return (
         max(time_min, decimal_year_to_mjd2000(1920)),
         min(time_max, decimal_year_to_mjd2000(2120)),
     )
class TestCoeffCHAOS7Combined(TestCase, CombinedShcTestMixIn):
    path_core = CHAOS7_CORE_LATEST
    path_static = CHAOS7_STATIC
    degree = 185
    min_degree = 1
    validity = decimal_year_to_mjd2000((1997.102, 2020.3036))
示例#37
0
 def times(self):
     return uniform(
         decimal_year_to_mjd2000(1990),
         decimal_year_to_mjd2000(2030),
         self.shape
     )