Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_ned_geodetic():
lla = pm.aer2geodetic(*aer0, *lla0)
enu3 = pm.geodetic2enu(*lla, *lla0)
ned3 = (enu3[1], enu3[0], -enu3[2])
assert pm.geodetic2ned(*lla, *lla0) == approx(ned3)
lat, lon, alt = pm.enu2geodetic(*enu3, *lla0)
assert lat == approx(lla[0])
assert lon == approx(lla[1])
assert alt == approx(lla[2])
lat, lon, alt = pm.ned2geodetic(*ned3, *lla0)
assert lat == approx(lla[0])
assert lon == approx(lla[1])
assert alt == approx(lla[2])
def test_aer_geodetic(aer, lla, lla0):
assert pm.aer2geodetic(*aer, *lla0) == approx(lla)
raer = (radians(aer[0]), radians(aer[1]), aer[2])
rlla0 = (radians(lla0[0]), radians(lla0[1]), lla0[2])
assert pm.aer2geodetic(*raer, *rlla0, deg=False) == approx((radians(lla[0]), radians(lla[1]), lla[2]))
with pytest.raises(ValueError):
pm.aer2geodetic(aer[0], aer[1], -1, *lla0)
assert pm.geodetic2aer(*lla, *lla0) == approx(aer, rel=1e-3)
assert pm.geodetic2aer(radians(lla[0]), radians(lla[1]), lla[2], *rlla0, deg=False) == approx(raer, rel=1e-3)
def test_allnan():
np = pytest.importorskip("numpy")
anan = np.empty((10, 10))
anan.fill(nan)
assert np.isnan(pm.geodetic2aer(anan, anan, anan, *lla0)).all()
assert np.isnan(pm.aer2geodetic(anan, anan, anan, *lla0)).all()
def test_aer_geodetic(aer, lla, lla0):
assert pm.aer2geodetic(*aer, *lla0) == approx(lla)
raer = (radians(aer[0]), radians(aer[1]), aer[2])
rlla0 = (radians(lla0[0]), radians(lla0[1]), lla0[2])
assert pm.aer2geodetic(*raer, *rlla0, deg=False) == approx((radians(lla[0]), radians(lla[1]), lla[2]))
with pytest.raises(ValueError):
pm.aer2geodetic(aer[0], aer[1], -1, *lla0)
assert pm.geodetic2aer(*lla, *lla0) == approx(aer, rel=1e-3)
assert pm.geodetic2aer(radians(lla[0]), radians(lla[1]), lla[2], *rlla0, deg=False) == approx(raer, rel=1e-3)
def test_scalar_nan():
a, e, r = pm.geodetic2aer(nan, nan, nan, *lla0)
assert isnan(a) and isnan(e) and isnan(r)
lat, lon, alt = pm.aer2geodetic(nan, nan, nan, *lla0)
assert isnan(lat) and isnan(lon) and isnan(alt)