コード例 #1
0
ファイル: test_normal.py プロジェクト: ioshchepkov/pygeoid
def test_surface_normal_gravity():
    ell = LevelEllipsoid('GRS80')
    np.testing.assert_almost_equal(
        ell.surface_normal_gravity(0. * u.deg).value,
        ell.equatorial_normal_gravity.value, decimal=9)
    np.testing.assert_almost_equal(
        ell.surface_normal_gravity(90. * u.deg).value,
        ell.polar_normal_gravity.value, decimal=9)

    # geodetic latitude
    lat = np.arange(-90, 90, 0.1, dtype=float) * u.deg
    rlat, _, u_ax = transform.geodetic_to_ellipsoidal(lat=lat,
                                                   lon=0.0 * u.deg,
                                                   height=0.0 * u.m, ell=ell)

    normal_gravity_somigliana = ell.surface_normal_gravity(lat)
    normal_gravity_ell = ell.normal_gravity(rlat, u_ax)

    np.testing.assert_almost_equal(
        normal_gravity_somigliana.value,
        normal_gravity_ell.value,
        decimal=9)

    # approximate formula (Clairaut)
    beta, beta1 = ell.conventional_gravity_coeffs()
    ge = ell.equatorial_normal_gravity
    latrad = np.radians(lat)
    normal_gravity_approx = ge*(1 + beta*np.sin(latrad)**2 -
                                beta1*np.sin(2*latrad)**2)

    np.testing.assert_almost_equal(
        normal_gravity_somigliana.value,
        normal_gravity_approx.value,
        decimal=6)

    np.testing.assert_almost_equal(
        surface_normal_gravity_clairaut(lat, '1980').to('mGal').value,
        normal_gravity_approx.to('mGal').value,
        decimal=1)
コード例 #2
0
def test_against_GRS80():
    # Moritz, H., 1980. Geodetic reference system 1980.
    # Bulletin géodésique, 54(3), pp.395-405.
    ell = LevelEllipsoid('GRS80')
    # geometric constants
    np.testing.assert_equal(ell.a, 6378137.0)
    np.testing.assert_almost_equal(ell.b, 6356752.3141, decimal=4)
    np.testing.assert_almost_equal(ell.linear_eccentricity,
                                   521854.0097, decimal=4)
    np.testing.assert_almost_equal(ell.polar_curvature_radius,
                                   6399593.6259, decimal=4)
    np.testing.assert_almost_equal(ell.eccentricity_squared,
                                   0.00669438002290, decimal=14)
    np.testing.assert_almost_equal(ell.second_eccentricity_squared,
                                   0.00673949677548, decimal=14)
    np.testing.assert_almost_equal(ell.flattening,
                                   0.00335281068118, decimal=14)
    np.testing.assert_almost_equal(ell.reciprocal_flattening,
                                   298.257222101, decimal=9)
    np.testing.assert_almost_equal(ell.quadrant_distance,
                                   10001965.7293, decimal=4)
    np.testing.assert_almost_equal(ell.surface_area * 1e-014,
                                   5.10065622, decimal=8)
    np.testing.assert_almost_equal(ell.volume * 1e-021,
                                   1.08320732, decimal=8)

    # mean radius
    kind = 'arithmetic'
    np.testing.assert_almost_equal(
        ell.mean_radius(kind), 6371008.7714, decimal=4)
    kind = 'same_area'
    np.testing.assert_almost_equal(ell.mean_radius(kind),
                                   6371007.1810, decimal=4)
    kind = 'same_volume'
    np.testing.assert_almost_equal(ell.mean_radius(kind),
                                   6371000.7900, decimal=4)

    # physical constants
    np.testing.assert_almost_equal(ell.surface_potential,
                                   62636860.850, decimal=3)
    np.testing.assert_almost_equal(ell.equatorial_normal_gravity,
                                   9.7803267715, decimal=10)
    np.testing.assert_almost_equal(ell.polar_normal_gravity,
                                   9.8321863685, decimal=10)
    np.testing.assert_almost_equal(ell.gravity_flattening,
                                   0.005302440112, decimal=12)
    np.testing.assert_almost_equal(ell._k,
                                   0.001931851353, decimal=12)

    np.testing.assert_almost_equal(ell.m,
                                   0.00344978600308, decimal=14)
    np.testing.assert_almost_equal(ell.j2n(n=2),
                                   -0.00000237091222, decimal=14)
    np.testing.assert_almost_equal(ell.j2n(n=3),
                                   0.00000000608347, decimal=14)
    np.testing.assert_almost_equal(ell.j2n(n=4),
                                   -0.00000000001427, decimal=14)

    np.testing.assert_almost_equal(ell.surface_normal_gravity(45.),
                                   9.806199203, decimal=9)

    np.testing.assert_almost_equal(ell.conventional_gravity_coeffs()[-1],
                                   0.0000058, decimal=7)

    # other
    np.testing.assert_almost_equal(ell.mean_normal_gravity,
                                   9.797644656, decimal=9)
    np.testing.assert_almost_equal(
        ell.surface_normal_gravity(45.),
        9.806199203, decimal=9)