Exemplo n.º 1
0
def test_inv():
    ell = Ellipsoid('WGS84')

    # check meridian arc
    np.testing.assert_almost_equal(ell.meridian_arc_distance(0.0, 90),
                                   ell.quadrant_distance,
                                   decimal=4)

    # check equatorial circle
    circle_length = 2 * np.pi * ell.a
    np.testing.assert_almost_equal(ell.parallel_arc_distance(0.0, 0.0, 90.),
                                   circle_length / 4,
                                   decimal=5)

    # Load short test data from Geographiclib
    # https://geographiclib.sourceforge.io/html/geodesic.html#testgeod
    path = os.path.dirname(os.path.abspath(__file__))
    fname = os.path.join(path, 'data/GeodTest-short.dat.gz')
    (lat1, lon1, azi1, lat2, lon2, azi2,
     dist12) = np.loadtxt(fname,
                          usecols=(0, 1, 2, 3, 4, 5, 6),
                          unpack=True,
                          dtype=np.float64)

    b_azi1, b_azi2, b_dist12 = ell.inv(lat1, lon1, lat2, lon2)

    # NOTE: Loss of precision
    np.testing.assert_array_almost_equal(b_azi1, azi1, decimal=3)
    np.testing.assert_array_almost_equal(b_azi2, azi2 - 180., decimal=3)
    np.testing.assert_array_almost_equal(b_dist12, dist12, decimal=8)
Exemplo n.º 2
0
def test_latitude_dependend_values():
    # From
    # Deakin, R.E. and Hunter, M.N., 2010. Geometric geodesy part A. Lecture
    # Notes, School of Mathematical & Geospatial Sciences, RMIT University,
    # Melbourne, Australia.
    # pp. 87 - 88
    ell = Ellipsoid('GRS80')
    lat = -(37 + 48 / 60 + 33.1234 / 3600) * u.deg

    np.testing.assert_almost_equal(ell._w(lat).value, 0.998741298, decimal=9)
    np.testing.assert_almost_equal(ell._v(lat).value, 1.002101154, decimal=9)
    np.testing.assert_almost_equal(ell.meridian_curvature_radius(lat).value,
                                   6359422.962,
                                   decimal=3)
    np.testing.assert_almost_equal(
        ell.prime_vertical_curvature_radius(lat).value, 6386175.289, decimal=3)
    np.testing.assert_almost_equal(ell.mean_curvature(lat).value,
                                   1 / 6372785.088,
                                   decimal=16)
    np.testing.assert_almost_equal(ell.meridian_arc_distance(0.0 * u.deg,
                                                             lat).value,
                                   4186320.340,
                                   decimal=3)