How to use the pymap3d.ecef2geodetic function in pymap3d

To help you get started, we’ve selected a few pymap3d examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scivision / pymap3d / tests / test_elliposid.py View on Github external
def test_ellipsoid():

    assert pm.ecef2geodetic(*xyz0, ell=pm.Ellipsoid("wgs84")) == approx([42.014670535, -82.0064785, 276.9136916])
    assert pm.ecef2geodetic(*xyz0, ell=pm.Ellipsoid("grs80")) == approx([42.014670536, -82.0064785, 276.9137385])
    assert pm.ecef2geodetic(*xyz0, ell=pm.Ellipsoid("clarke1866")) == approx([42.01680003, -82.0064785, 313.9026793])
    assert pm.ecef2geodetic(*xyz0, ell=pm.Ellipsoid("mars")) == approx([42.009428417, -82.006479, 2.981246e6])
    assert pm.ecef2geodetic(*xyz0, ell=pm.Ellipsoid("venus")) == approx([41.8233663, -82.0064785, 3.17878159e5])
    assert pm.ecef2geodetic(*xyz0, ell=pm.Ellipsoid("moon")) == approx([41.8233663, -82.0064785, 4.630878e6])
github scivision / pymap3d / tests / test_elliposid.py View on Github external
def test_ellipsoid():

    assert pm.ecef2geodetic(*xyz0, ell=pm.Ellipsoid("wgs84")) == approx([42.014670535, -82.0064785, 276.9136916])
    assert pm.ecef2geodetic(*xyz0, ell=pm.Ellipsoid("grs80")) == approx([42.014670536, -82.0064785, 276.9137385])
    assert pm.ecef2geodetic(*xyz0, ell=pm.Ellipsoid("clarke1866")) == approx([42.01680003, -82.0064785, 313.9026793])
    assert pm.ecef2geodetic(*xyz0, ell=pm.Ellipsoid("mars")) == approx([42.009428417, -82.006479, 2.981246e6])
    assert pm.ecef2geodetic(*xyz0, ell=pm.Ellipsoid("venus")) == approx([41.8233663, -82.0064785, 3.17878159e5])
    assert pm.ecef2geodetic(*xyz0, ell=pm.Ellipsoid("moon")) == approx([41.8233663, -82.0064785, 4.630878e6])
github scivision / pymap3d / tests / test_geodetic.py View on Github external
def test_somenan():
    np = pytest.importorskip("numpy")
    xyz = np.stack((xyz0, (nan, nan, nan)))

    lat, lon, alt = pm.ecef2geodetic(xyz[:, 0], xyz[:, 1], xyz[:, 2])
    assert (lat[0], lon[0], alt[0]) == approx(lla0)
github scivision / pymap3d / tests / test_geodetic.py View on Github external
def test_ecef():
    xyz = pm.geodetic2ecef(*lla0)

    assert xyz == approx(xyz0)
    x, y, z = pm.geodetic2ecef(*rlla0, deg=False)
    assert x == approx(xyz[0])
    assert y == approx(xyz[1])
    assert z == approx(xyz[2])

    with pytest.raises(ValueError):
        pm.geodetic2ecef(-100, lla0[1], lla0[2])

    assert pm.ecef2geodetic(*xyz) == approx(lla0)
    assert pm.ecef2geodetic(*xyz, deg=False) == approx(rlla0)

    assert pm.ecef2geodetic((A - 1) / sqrt(2), (A - 1) / sqrt(2), 0) == approx([0, 45, -1])
github scivision / pymap3d / tests / test_geodetic.py View on Github external
def test_ecef():
    xyz = pm.geodetic2ecef(*lla0)

    assert xyz == approx(xyz0)
    x, y, z = pm.geodetic2ecef(*rlla0, deg=False)
    assert x == approx(xyz[0])
    assert y == approx(xyz[1])
    assert z == approx(xyz[2])

    with pytest.raises(ValueError):
        pm.geodetic2ecef(-100, lla0[1], lla0[2])

    assert pm.ecef2geodetic(*xyz) == approx(lla0)
    assert pm.ecef2geodetic(*xyz, deg=False) == approx(rlla0)

    assert pm.ecef2geodetic((A - 1) / sqrt(2), (A - 1) / sqrt(2), 0) == approx([0, 45, -1])
github scivision / pymap3d / tests / test_geodetic.py View on Github external
def test_ecef2geodetic(xyz, lla):
    lat, lon, alt = pm.ecef2geodetic(*xyz)
    assert lat == approx(lla[0])
    assert lon == approx(lla[1])
    assert alt == approx(lla[2])
github scivision / pymap3d / tests / test_geodetic.py View on Github external
def test_ecef():
    xyz = pm.geodetic2ecef(*lla0)

    assert xyz == approx(xyz0)
    x, y, z = pm.geodetic2ecef(*rlla0, deg=False)
    assert x == approx(xyz[0])
    assert y == approx(xyz[1])
    assert z == approx(xyz[2])

    with pytest.raises(ValueError):
        pm.geodetic2ecef(-100, lla0[1], lla0[2])

    assert pm.ecef2geodetic(*xyz) == approx(lla0)
    assert pm.ecef2geodetic(*xyz, deg=False) == approx(rlla0)

    assert pm.ecef2geodetic((A - 1) / sqrt(2), (A - 1) / sqrt(2), 0) == approx([0, 45, -1])
github scivision / pymap3d / tests / test_geodetic.py View on Github external
def test_scalar_ecef2geodetic(xyz):
    """
    verify we can handle the wide variety of input data type users might use
    """
    if isinstance(xyz[0], list):
        pytest.importorskip("numpy")

    lat, lon, alt = pm.ecef2geodetic(*xyz)

    assert [lat, lon, alt] == approx(lla0, rel=1e-4)
github scivision / pymap3d / tests / test_geodetic.py View on Github external
def test_xarray():
    xarray = pytest.importorskip("xarray")
    xr_lla = xarray.DataArray(list(lla0))

    xyz = pm.geodetic2ecef(*xr_lla)

    assert xyz == approx(xyz0)
    # %%
    xr_xyz = xarray.DataArray(list(xyz0))

    lla = pm.ecef2geodetic(*xr_xyz)

    assert lla == approx(lla0)
github dstl / Stone-Soup / stonesoup / writer / kml.py View on Github external
[enu2geodetic(enu_pos[0], enu_pos[1],
                                  enu_pos[2], self.reference_point[1],
                                  self.reference_point[0],
                                  self.reference_point[2])
                     for enu_pos in tks_pos])
                tks_pos_matrix_lla.append(tks_pos_lla)
        elif (self.coordinate_system is CoordinateSystems.ECEF):
            det_pos_array_lla = np.array(
                [ecef2geodetic(
                    ecef_pos[0], ecef_pos[1], ecef_pos[2],
                    self.reference_point[1], self.reference_point[0],
                    self.reference_point[2]) for ecef_pos in det_pos_array])
            tks_pos_matrix_lla = []
            for tks_pos in tks_pos_matrix:
                tks_pos_lla = np.array(
                    [ecef2geodetic(
                        ecef_pos[0], ecef_pos[1], ecef_pos[2],
                        self.reference_point[1], self.reference_point[0],
                        self.reference_point[2]) for ecef_pos in tks_pos])
                tks_pos_matrix_lla.append(tks_pos_lla)
        elif (self.coordinate_system is CoordinateSystems.LONLAT):
            det_pos_array_lla = np.array(
                [(lonlat_pos[1], lonlat_pos[0], 0.0)
                 for lonlat_pos in det_pos_array])
            tks_pos_matrix_lla = []
            for tks_pos in tks_pos_matrix:
                tks_pos_lla = np.array(
                    [(lonlat_pos[1], lonlat_pos[0], 0.0)
                     for lonlat_pos in tks_pos])
                tks_pos_matrix_lla.append(tks_pos_lla)
        elif (self.coordinate_system is CoordinateSystems.LLA):
            # Nothing to do.