예제 #1
0
    def test_deprecation_warning_geodetic_to_geocentric(self):
        """Test if geodetic_to_geocentric in coords is deprecated"""

        with warnings.catch_warnings(record=True) as war:
            coords.geodetic_to_geocentric(45.0, lon_in=8.0)

        assert len(war) >= 1
        assert war[0].category == DeprecationWarning
예제 #2
0
    def test_geodetic_to_geocentric_inverse(self):
        """Tests the reversibility of geodetic to geocentric conversions"""

        lat1 = 37.5
        lon1 = 117.3
        lat2, lon2, rad_e = coords.geodetic_to_geocentric(lat1, lon_in=lon1,
                                                          inverse=False)
        lat3, lon3, rad_e = coords.geodetic_to_geocentric(lat2, lon_in=lon2,
                                                          inverse=True)
        assert abs(lon1-lon3) < 1.0e-6
        assert abs(lat1-lat3) < 1.0e-6
예제 #3
0
    def test_geodetic_to_geocentric_single(self):
        """Test conversion from geodetic to geocentric coordinates"""

        lat, lon, rad = coords.geodetic_to_geocentric(45.0, lon_in=8.0)

        assert abs(lat - 44.807576784018046) < 1.0e-6
        assert abs(lon - 8.0) < 1.0e-6
        assert abs(rad - 6367.489543863465) < 1.0e-6
예제 #4
0
    def test_geocentric_to_geodetic_single(self):
        """Test conversion from geocentric to geodetic coordinates"""

        lat, lon, rad = coords.geodetic_to_geocentric(45.0, lon_in=8.0,
                                                      inverse=True)

        assert abs(lat - 45.192423215981954) < 1.0e-6
        assert abs(lon - 8.0) < 1.0e-6
        assert abs(rad - 6367.345908499981) < 1.0e-6
예제 #5
0
    def test_geodetic_to_geocentric_mult(self):
        """Test array conversion from geodetic to geocentric coordinates"""

        arr = np.ones(shape=(10,), dtype=float)
        lat, lon, rad = coords.geodetic_to_geocentric(45.0*arr, lon_in=8.0*arr)

        assert lat.shape == arr.shape
        assert lon.shape == arr.shape
        assert rad.shape == arr.shape
        assert abs(lat - 44.807576784018046).max() < 1.0e-6
        assert abs(lon - 8.0).max() < 1.0e-6
        assert abs(rad - 6367.489543863465).max() < 1.0e-6
예제 #6
0
    def test_geocentric_to_geodetic_mult(self):
        """Test array conversion from geocentric to geodetic coordinates"""

        arr = np.ones(shape=(10,), dtype=float)
        lat, lon, rad = coords.geodetic_to_geocentric(45.0*arr, lon_in=8.0*arr,
                                                      inverse=True)

        assert lat.shape == arr.shape
        assert lon.shape == arr.shape
        assert rad.shape == arr.shape
        assert abs(lat - 45.192423215981954).max() < 1.0e-6
        assert abs(lon - 8.0).max() < 1.0e-6
        assert abs(rad - 6367.345908499981).max() < 1.0e-6