def test_deprecation_warning_geodetic_to_geocentric_horz(self): """Test if geodetic_to_geocentric_horizontal in coords is deprecated""" with warnings.catch_warnings(record=True) as war: coords.geodetic_to_geocentric_horizontal(45.0, 8.0, 52.0, 63.0) assert len(war) >= 1 assert war[0].category == DeprecationWarning
def test_geodetic_to_geocentric_horizontal_inverse(self): """Tests the reversibility of geodetic to geocentric horiz conversions Note: inverse of az and el angles currently non-functional""" lat1 = -17.5 lon1 = 187.3 az1 = 52.0 el1 = 63.0 lat2, lon2, rad_e, az2, el2 = \ coords.geodetic_to_geocentric_horizontal(lat1, lon1, az1, el1, inverse=False) lat3, lon3, rad_e, az3, el3 = \ coords.geodetic_to_geocentric_horizontal(lat2, lon2, az2, el2, inverse=True) assert abs(lon1-lon3) < 1.0e-6 assert abs(lat1-lat3) < 1.0e-6 assert abs(az1-az3) < 1.0e-6 assert abs(el1-el3) < 1.0e-6
def test_geodetic_to_geocentric_horz_single(self): """Test conversion from geodetic to geocentric coordinates""" lat, lon, rad, az, el = \ coords.geodetic_to_geocentric_horizontal(45.0, 8.0, 52.0, 63.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 assert abs(az - 51.70376774257361) < 1.0e-6 assert abs(el - 62.8811403841008) < 1.0e-6
def test_geocentric_to_geodetic_horz_single(self): """Test conversion from geocentric to geodetic coordinates""" lat, lon, rad, az, el = \ coords.geodetic_to_geocentric_horizontal(45.0, 8.0, 52.0, 63.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 assert abs(az - 52.29896101551479) < 1.0e-6 assert abs(el - 63.118072033649916) < 1.0e-6
def test_geodetic_to_geocentric_horz_mult(self): """Test array conversion from geodetic to geocentric coordinates""" arr = np.ones(shape=(10,), dtype=float) lat, lon, rad, az, el = \ coords.geodetic_to_geocentric_horizontal(45.0*arr, 8.0*arr, 52.0*arr, 63.0*arr) assert lat.shape == arr.shape assert lon.shape == arr.shape assert rad.shape == arr.shape assert az.shape == arr.shape assert el.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 assert abs(az - 51.70376774257361).max() < 1.0e-6 assert abs(el - 62.8811403841008).max() < 1.0e-6
def test_geocentric_to_geodetic_horz_mult(self): """Test array conversion from geocentric to geodetic coordinates""" arr = np.ones(shape=(10,), dtype=float) lat, lon, rad, az, el = \ coords.geodetic_to_geocentric_horizontal(45.0*arr, 8.0*arr, 52.0*arr, 63.0*arr, inverse=True) assert lat.shape == arr.shape assert lon.shape == arr.shape assert rad.shape == arr.shape assert az.shape == arr.shape assert el.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 assert abs(az - 52.29896101551479).max() < 1.0e-6 assert abs(el - 63.118072033649916).max() < 1.0e-6