How to use the pyinterp.core.geodetic.Coordinates function in pyinterp

To help you get started, we’ve selected a few pyinterp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CNES / pangeo-pyinterp / tests / core / test_geodetic.py View on Github external
def test_coordinates_round_trip(self):
        """Check algorithm precision"""
        lon1 = np.random.uniform(-180.0, 180.0, 1000000)
        lat1 = np.random.uniform(-90.0, 90.0, 1000000)
        alt1 = np.random.uniform(-10000, 100000, 1000000)

        a = core.geodetic.Coordinates(None)
        b = core.geodetic.Coordinates(None)

        lon2, lat2, alt2 = a.transform(b, lon1, lat1, alt1, num_threads=0)

        self.assertAlmostEqual((lon1 - lon2).mean(), 0, delta=1e-12)
        self.assertAlmostEqual((lat1 - lat2).mean(), 0, delta=1e-12)
        self.assertAlmostEqual((alt1 - alt2).mean(), 0, delta=1e-10)
github CNES / pangeo-pyinterp / tests / core / test_geodetic.py View on Github external
def test_pickle(self):
        """Serialization test"""
        a = core.geodetic.Coordinates(None)
        b = pickle.loads(pickle.dumps(a))
        self.assertTrue(np.all(a.__getstate__() == b.__getstate__()))
github CNES / pangeo-pyinterp / tests / core / test_geodetic.py View on Github external
def test_coordinates_ecef_lla(self):
        """ECEF/LLA Conversion Test"""
        lon, lat, alt = core.geodetic.Coordinates(None).ecef_to_lla(
            [1176498.769459714], [5555043.905503586], [2895446.8901510699])
        self.assertAlmostEqual(78.042068, lon[0], delta=1e-8)
        self.assertAlmostEqual(27.173891, lat[0], delta=1e-8)
        self.assertAlmostEqual(168.0, alt[0], delta=1e-8)
github CNES / pangeo-pyinterp / tests / core / test_geodetic.py View on Github external
def test_coordinates_lla_to_ecef(self):
        """LLA/ECEF Conversion Test"""
        x, y, z = core.geodetic.Coordinates(None).lla_to_ecef([78.042068],
                                                              [27.173891],
                                                              [168.0])
        self.assertAlmostEqual(1176498.769459714, x[0], delta=1e-8)
        self.assertAlmostEqual(5555043.905503586, y[0], delta=1e-8)
        self.assertAlmostEqual(2895446.8901510699, z[0], delta=1e-8)
github CNES / pangeo-pyinterp / tests / core / test_geodetic.py View on Github external
def test_coordinates_round_trip(self):
        """Check algorithm precision"""
        lon1 = np.random.uniform(-180.0, 180.0, 1000000)
        lat1 = np.random.uniform(-90.0, 90.0, 1000000)
        alt1 = np.random.uniform(-10000, 100000, 1000000)

        a = core.geodetic.Coordinates(None)
        b = core.geodetic.Coordinates(None)

        lon2, lat2, alt2 = a.transform(b, lon1, lat1, alt1, num_threads=0)

        self.assertAlmostEqual((lon1 - lon2).mean(), 0, delta=1e-12)
        self.assertAlmostEqual((lat1 - lat2).mean(), 0, delta=1e-12)
        self.assertAlmostEqual((alt1 - alt2).mean(), 0, delta=1e-10)