def test_ellipsoid2d(self): """Test the calculation of new inclinated ellipsoids.""" ellipsoid = geodesy.ellipsoidmodels().get('WGS84') e = geodesy.ellipsoid2d(ellipsoid, 0) assert e == (ellipsoid[0], 0)
def test_ellipsoidcurvradius(self): """Test the calculation of local curvature radius.""" ellipsoid = geodesy.ellipsoidmodels().get('WGS84') e = geodesy.ellipsoidcurvradius(ellipsoid, 0, 90) assert e == (ellipsoid[0], 0)
def test_ellipsoidmodels(self): """Check ellipsoidmodels for valid excentricities.""" e = geodesy.ellipsoidmodels() exc = np.array([e[m][1] for m in e.models]) assert (np.all(exc >= 0) and np.all(exc < 1))
def test_ellipsoidmodels(self): """Check ellipsoidmodels for valid excentricities.""" e = geodesy.ellipsoidmodels() exc = np.array([e[m][1] for m in e.models]) assert np.all(exc >= 0) and np.all(exc < 1)
def test_ellipsoid_r_geocentric(self): """Test return of geocentric radius for all ellipsois.""" ellipsoid = geodesy.ellipsoidmodels().get('WGS84') r = geodesy.ellipsoid_r_geocentric(ellipsoid, 0) # Radius at equator has to be equal to the one defined in the # ellipsoidmodel. assert ellipsoid[0] == r
def test_geodetic2geocentric2geodetic(self): """Test conversion from geodetic to geocentric system and back.""" ellipsoid = geodesy.ellipsoidmodels().get('WGS84') ref = (1, -13, 42) geoc = geodesy.geodetic2geocentric(*ref, ellipsoid) geod = geodesy.geocentric2geodetic(*geoc, ellipsoid) assert np.allclose(ref, geod)
def test_geodetic2cart2geodetic(self): """Test conversion from geodetic to cartesian system and back.""" ellipsoid = geodesy.ellipsoidmodels().get('WGS84') ref = (1, -13, 42) cart = geodesy.geodetic2cart(*ref, ellipsoid) geod = geodesy.cart2geodetic(*cart, ellipsoid) assert np.allclose(ref, geod)
def test_geodetic2cart(self): """Test conversion from geodetic to cartesian system.""" r = geodesy.ellipsoidmodels().get('WGS84')[0] geodetic = (np.array([0, 0]), # r np.array([0, 0]), # lat np.array([0, 90]), # lon ) reference = (np.array([r, 0]), # x np.array([0, r]), # y np.array([0, 0]), # z ) conversion = geodesy.geodetic2cart(*geodetic) assert np.allclose(conversion, reference)
def test_cart2geodetic(self): """Test conversion from cartesian to geodetic system.""" r = geodesy.ellipsoidmodels().get('WGS84')[0] cartesian = (np.array([r, 0]), # x np.array([0, r]), # y np.array([0, 0]), # z ) reference = (np.array([0, 0]), # r np.array([0, 00]), # lat np.array([0, 90]), # lon ) conversion = geodesy.cart2geodetic(*cartesian) assert np.allclose(conversion, reference)
def test_geodetic2geocentric2geodetic(self): """Test geodetic/geocentric conversion for all ellipsoids.""" e = geodesy.ellipsoidmodels() for model in e.models: yield self._test_geodetic2geocentric2geodetic, e[model]
def test_geodetic2cart2geodetic(self): """Test geodetic/cartesian conversion for all ellipsoids.""" e = geodesy.ellipsoidmodels() for model in e.models: yield self._test_geodetic2cart2geodetic, e[model]