def test_h_calculation_near_lat_singularity(lat): body = Earth lon = 10 * u.deg h = 5 * u.m p = SpheroidLocation(lon, lat, h, body) cartesian_coords = p.cartesian_cords lat_, lon_, h_ = p.cartesian_to_ellipsoidal(*cartesian_coords) assert_quantity_allclose(h_, h)
def test_cartesian_conversion_approximate(): el_cords = (0.670680 * u.rad, 0.7190227 * u.rad, 0 * u.m) c_cords = [3764258.64785411 * u.m, 3295359.33856106 * u.m, 3942945.28570563 * u.m] p = SpheroidLocation(*el_cords, Earth) cords = p.cartesian_to_ellipsoidal(*c_cords) # TODO: Find ways to improve error margin assert_quantity_allclose(el_cords[0], cords[0], 1e-4) assert_quantity_allclose(el_cords[1], cords[1], 1e-4) assert_quantity_allclose(el_cords[2], cords[2], 1)