Ejemplo n.º 1
0
    def test_geodetic_to_ecef(self):
        orthodrome.geodetic_to_ecef(23., 0., 0.)

        a = orthodrome.earthradius_equator
        b = orthodrome.earthradius_equator * (1. - orthodrome.earth_oblateness)

        points = [((90., 0., 0.), (0., 0., b)),
                  ((-90., 0., 10.), (0., 0., -b - 10.)),
                  ((0., 0., 0.), (a, 0., 0.))]

        for p in points:
            assert_ae(orthodrome.geodetic_to_ecef(*p[0]), p[1])
Ejemplo n.º 2
0
    def test_geodetic_to_ecef(self):
        orthodrome.geodetic_to_ecef(23., 0., 0.)
        wgs = orthodrome.get_wgs84()
        a = wgs.a
        b = wgs.a * (1. - wgs.f)

        points = [((90., 0., 0.), (0., 0., b)),
                  ((-90., 0., 10.), (0., 0., -b - 10.)),
                  ((0., 0., 0.), (a, 0., 0.))]

        for p in points:
            num.testing.assert_almost_equal(orthodrome.geodetic_to_ecef(*p[0]),
                                            p[1])
    def test_geodetic_to_ecef(self):
        orthodrome.geodetic_to_ecef(23., 0., 0.)

        a = orthodrome.earthradius_equator
        b = orthodrome.earthradius_equator * (1. - orthodrome.earth_oblateness)

        points = [
            ((90., 0., 0.), (0., 0., b)),
            ((-90., 0., 10.), (0., 0., -b-10.)),
            ((0., 0., 0.), (a, 0., 0.))]

        for p in points:
            num.testing.assert_almost_equal(orthodrome.geodetic_to_ecef(*p[0]),
                                            p[1])
Ejemplo n.º 4
0
    def test_ecef_to_geodetic(self):
        ncoords = 5
        lats = num.random.uniform(-90., 90, size=ncoords)
        lons = num.random.uniform(-180., 180, size=ncoords)
        alts = num.random.uniform(0, 10, size=ncoords)

        coords = num.array([lats, lons, alts]).T

        for ic in range(coords.shape[0]):
            xyz = orthodrome.geodetic_to_ecef(*coords[ic, :])
            latlonalt = orthodrome.ecef_to_geodetic(*xyz)

            assert_ae(coords[ic, :], latlonalt)
    def test_ecef_to_geodetic(self):
        ncoords = 5
        lats = num.random.uniform(-90., 90, size=ncoords)
        lons = num.random.uniform(-180., 180, size=ncoords)
        alts = num.random.uniform(0, 10, size=ncoords)

        coords = num.array([lats, lons, alts]).T

        for ic in range(coords.shape[0]):
            xyz = orthodrome.geodetic_to_ecef(*coords[ic, :])
            latlonalt = orthodrome.ecef_to_geodetic(*xyz)

            num.testing.assert_almost_equal(coords[ic, :], latlonalt)
Ejemplo n.º 6
0
 def g_to_e(*args):
     return num.array(orthodrome.geodetic_to_ecef(*args))
Ejemplo n.º 7
0
def latlondepth_to_cartesian(lat, lon, depth):
    return orthodrome.geodetic_to_ecef(lat, lon, -depth)