Example #1
0
 def test_positional_false_true(self):
     path = GeoidModel.default_geoid_path()
     model = GeoidModel(self.MODEL_NAME, path, False, True)
     self.assertEqual(model.geoid_name(), self.MODEL_NAME)
     self.assertEqual(model.geoid_directory(), path)
     self.assertEqual(model.interpolation(), 'bilinear')
     self.assertTrue(model.threadsafe())
Example #2
0
class InfoMethodsTestCase(unittest.TestCase):
    def setUp(self) -> None:
        self.name = GeoidModel.default_geoid_name()
        self.datapath = GeoidModel.default_geoid_path()
        self.model = GeoidModel(self.name, self.datapath)

    def test_description(self):
        description = self.model.description()
        self.assertIsInstance(description, str)
        self.assertNotEqual(description, 'NONE')

    def test_datetime(self):
        datestr = self.model.datetime()
        self.assertIsInstance(datestr, str)
        self.assertNotEqual(datestr, 'UNKNOWN')
        # date = datetime.datetime.strptime(datestr, '%Y-%m-%d')
        date = datetime.datetime.strptime(datestr, '%Y-%m-%d %H:%M:%S')
        self.assertLess(date, datetime.datetime.now())

    def test_geoid_file(self):
        filename = self.model.geoid_file()
        self.assertIn(self.name, filename)
        self.assertIn(self.datapath, filename)

    def test_geoid_name(self):
        name = self.model.geoid_name()
        self.assertEqual(name, self.name)

    def test_geoid_directory(self):
        path = self.model.geoid_directory()
        self.assertEqual(path, self.datapath)

    def test_interpolation(self):
        self.assertIn(self.model.interpolation(), ['cubic', 'bilinear'])

    def test_threadsafe(self):
        self.assertIsInstance(self.model.threadsafe(), bool)

    def test_max_error(self):
        self.assertIsInstance(self.model.max_error(), float)
        self.assertGreater(self.model.max_error(), 0)

    def test_rms_error(self):
        self.assertIsInstance(self.model.rms_error(), float)
        self.assertGreater(self.model.rms_error(), 0)

    def test_max_vs_rms_error(self):
        self.assertLessEqual(self.model.rms_error(), self.model.max_error())

    def test_offset(self):
        self.assertIsInstance(self.model.offset(), float)

    def test_scale(self):
        self.assertIsInstance(self.model.scale(), float)
        self.assertGreater(self.model.scale(), 0)

    def equator_radius(self):
        self.assertIsInstance(self.model.equator_radius(), float)
        self.assertGreater(self.model.equator_radius(), 5e6)

    def test_flattening(self):
        self.assertIsInstance(self.model.flattening(), float)
        self.assertGreater(self.model.flattening(), 0)
        self.assertLess(self.model.flattening(), 1)
Example #3
0
 def test_cubic_false(self):
     path = GeoidModel.default_geoid_path()
     model = GeoidModel(self.MODEL_NAME, path, cubic=False)
     self.assertEqual(model.geoid_name(), self.MODEL_NAME)
     self.assertEqual(model.geoid_directory(), path)
     self.assertEqual(model.interpolation(), 'bilinear')