def test__geo2qd_longitude(): A = Apex(date=2000, refh=300) assert_allclose(A._geo2qd(60, 180, 100), fa.apxg2q(60, 180, 100, 0)[:2]) assert_allclose(A._geo2qd(60, -180, 100), fa.apxg2q(60, -180, 100, 0)[:2]) assert_allclose(A._geo2qd(60, -180, 100), A._geo2qd(60, 180, 100)) for i in range(-5, 5): for lat in [0, 30, 60, 90]: assert_allclose(A._geo2qd(lat, 15+i*360, 100), fa.apxg2q(lat, 15, 100, 0)[:2])
def test__geo2qd_longitude(): A = Apex(date=2000, refh=300) assert_allclose(A._geo2qd(60, 180, 100), fa.apxg2q(60, 180, 100, 0)[:2]) assert_allclose(A._geo2qd(60, -180, 100), fa.apxg2q(60, -180, 100, 0)[:2]) assert_allclose(A._geo2qd(60, -180, 100), A._geo2qd(60, 180, 100)) for i in range(-5, 5): for lat in [0, 30, 60, 90]: assert_allclose(A._geo2qd(lat, 15 + i * 360, 100), fa.apxg2q(lat, 15, 100, 0)[:2])
def test__geo2qd_array(): A = Apex(date=2000, refh=300) lats, lons = A._geo2qd([[0, 30], [60, 90]], 15, [[100, 200], [300, 400]]) lat1, lon1 = fa.apxg2q(0, 15, 100, 0)[:2] lat2, lon2 = fa.apxg2q(30, 15, 200, 0)[:2] lat3, lon3 = fa.apxg2q(60, 15, 300, 0)[:2] lat4, lon4 = fa.apxg2q(90, 15, 400, 0)[:2] assert_allclose(lats.astype(float), np.array([[lat1, lat2], [lat3, lat4]], dtype=float)) assert_allclose(lons.astype(float), np.array([[lon1, lon2], [lon3, lon4]], dtype=float))
def test__geo2qd_array(): A = Apex(date=2000, refh=300) lats, lons = A._geo2qd([[0, 30], [60, 90]], 15, [[100, 200], [300, 400]]) lat1, lon1 = fa.apxg2q(0, 15, 100, 0)[:2] lat2, lon2 = fa.apxg2q(30, 15, 200, 0)[:2] lat3, lon3 = fa.apxg2q(60, 15, 300, 0)[:2] lat4, lon4 = fa.apxg2q(90, 15, 400, 0)[:2] assert_allclose(lats.astype(float), np.array([[lat1, lat2], [lat3, lat4]], dtype=float)) assert_allclose(lons.astype(float), np.array([[lon1, lon2], [lon3, lon4]], dtype=float))
def test__geo2qd_scalar(): A = Apex(date=2000, refh=300) for lat in [0, 30, 60, 89]: for lon in [-179, -90, 0, 90, 180]: assert_allclose(A._geo2qd(lat, lon, 100), fa.apxg2q(lat, lon, 100, 0)[:2])
def test_geo2qd(): A = Apex(date=2000, refh=300) lat, lon = A.geo2qd(60, 15, 100) assert_allclose((lat, lon), A._geo2qd(60, 15, 100)) assert type(lat) != np.ndarray assert type(lon) != np.ndarray
def test__geo2qd_scalar(): apex_out = Apex(date=2000, refh=300) for lat in [0, 30, 60, 89]: for lon in [-179, -90, 0, 90, 180]: assert_allclose(apex_out._geo2qd(lat, lon, 100), fa.apxg2q(lat, lon, 100, 0)[:2])
def test_geo2qd(): apex_out = Apex(date=2000, refh=300) lat, lon = apex_out.geo2qd(60, 15, 100) assert_allclose((lat, lon), apex_out._geo2qd(60, 15, 100)) assert type(lat) != np.ndarray assert type(lon) != np.ndarray