diff --git a/src/pymap3d/__init__.py b/src/pymap3d/__init__.py index 7541de8..6ce8b10 100644 --- a/src/pymap3d/__init__.py +++ b/src/pymap3d/__init__.py @@ -58,6 +58,25 @@ from .spherical import geodetic2spherical, spherical2geodetic from .timeconv import str2dt +from .latitude import ( + geodetic2isometric, + isometric2geodetic, + geodetic2rectifying, + rectifying2geodetic, + geodetic2conformal, + conformal2geodetic, + geodetic2parametric, + parametric2geodetic, + geodetic2geocentric, + geocentric2geodetic, + geodetic2authalic, + authalic2geodetic, + geod2geoc, + geoc2geod, +) + +from .rcurve import parallel, meridian, transverse, geocentric_radius + __all__ = [ "aer2ecef", "aer2geodetic", @@ -92,6 +111,24 @@ "str2dt", "azel2radec", "radec2azel", + "parallel", + "meridian", + "transverse", + "geocentric_radius", + "geodetic2isometric", + "isometric2geodetic", + "geodetic2rectifying", + "rectifying2geodetic", + "geodetic2conformal", + "conformal2geodetic", + "geodetic2parametric", + "parametric2geodetic", + "geodetic2geocentric", + "geocentric2geodetic", + "geodetic2authalic", + "authalic2geodetic", + "geod2geoc", + "geoc2geod", ] try: diff --git a/src/pymap3d/tests/test_latitude.py b/src/pymap3d/tests/test_latitude.py index 058c8b4..023693d 100644 --- a/src/pymap3d/tests/test_latitude.py +++ b/src/pymap3d/tests/test_latitude.py @@ -1,6 +1,6 @@ from math import inf, radians -import pymap3d.latitude as latitude +import pymap3d as pm import pymap3d.rcurve as rcurve import pytest from pytest import approx @@ -11,16 +11,16 @@ [(0, 0, 0), (90, 0, 90), (-90, 0, -90), (45, 0, 44.80757678), (-45, 0, -44.80757678)], ) def test_geodetic_alt_geocentric(geodetic_lat, alt_m, geocentric_lat): - assert latitude.geod2geoc(geodetic_lat, alt_m) == approx(geocentric_lat) + assert pm.geod2geoc(geodetic_lat, alt_m) == approx(geocentric_lat) r = rcurve.geocentric_radius(geodetic_lat) - assert latitude.geoc2geod(geocentric_lat, r) == approx(geodetic_lat) - assert latitude.geoc2geod(geocentric_lat, 1e5 + r) == approx( - latitude.geocentric2geodetic(geocentric_lat, 1e5 + alt_m) + assert pm.geoc2geod(geocentric_lat, r) == approx(geodetic_lat) + assert pm.geoc2geod(geocentric_lat, 1e5 + r) == approx( + pm.geocentric2geodetic(geocentric_lat, 1e5 + alt_m) ) - assert latitude.geod2geoc(geodetic_lat, 1e5 + alt_m) == approx( - latitude.geodetic2geocentric(geodetic_lat, 1e5 + alt_m) + assert pm.geod2geoc(geodetic_lat, 1e5 + alt_m) == approx( + pm.geodetic2geocentric(geodetic_lat, 1e5 + alt_m) ) @@ -29,21 +29,21 @@ def test_geodetic_alt_geocentric(geodetic_lat, alt_m, geocentric_lat): [(0, 0), (90, 90), (-90, -90), (45, 44.80757678), (-45, -44.80757678)], ) def test_geodetic_geocentric(geodetic_lat, geocentric_lat): - assert latitude.geodetic2geocentric(geodetic_lat, 0) == approx(geocentric_lat) - assert latitude.geodetic2geocentric(radians(geodetic_lat), 0, deg=False) == approx( + assert pm.geodetic2geocentric(geodetic_lat, 0) == approx(geocentric_lat) + assert pm.geodetic2geocentric(radians(geodetic_lat), 0, deg=False) == approx( radians(geocentric_lat) ) - assert latitude.geocentric2geodetic(geocentric_lat, 0) == approx(geodetic_lat) - assert latitude.geocentric2geodetic(radians(geocentric_lat), 0, deg=False) == approx( + assert pm.geocentric2geodetic(geocentric_lat, 0) == approx(geodetic_lat) + assert pm.geocentric2geodetic(radians(geocentric_lat), 0, deg=False) == approx( radians(geodetic_lat) ) def test_numpy_geodetic_geocentric(): pytest.importorskip("numpy") - assert latitude.geodetic2geocentric([45, 0], 0) == approx([44.80757678, 0]) - assert latitude.geocentric2geodetic([44.80757678, 0], 0) == approx([45, 0]) + assert pm.geodetic2geocentric([45, 0], 0) == approx([44.80757678, 0]) + assert pm.geocentric2geodetic([44.80757678, 0], 0) == approx([45, 0]) @pytest.mark.parametrize( @@ -58,24 +58,24 @@ def test_numpy_geodetic_geocentric(): ], ) def test_geodetic_isometric(geodetic_lat, isometric_lat): - isolat = latitude.geodetic2isometric(geodetic_lat) + isolat = pm.geodetic2isometric(geodetic_lat) assert isolat == approx(isometric_lat) assert isinstance(isolat, float) - assert latitude.geodetic2isometric(radians(geodetic_lat), deg=False) == approx( + assert pm.geodetic2isometric(radians(geodetic_lat), deg=False) == approx( radians(isometric_lat) ) - assert latitude.isometric2geodetic(isometric_lat) == approx(geodetic_lat) - assert latitude.isometric2geodetic(radians(isometric_lat), deg=False) == approx( + assert pm.isometric2geodetic(isometric_lat) == approx(geodetic_lat) + assert pm.isometric2geodetic(radians(isometric_lat), deg=False) == approx( radians(geodetic_lat) ) def test_numpy_geodetic_isometric(): pytest.importorskip("numpy") - assert latitude.geodetic2isometric([45, 0]) == approx([50.227466, 0]) - assert latitude.isometric2geodetic([50.227466, 0]) == approx([45, 0]) + assert pm.geodetic2isometric([45, 0]) == approx([50.227466, 0]) + assert pm.isometric2geodetic([50.227466, 0]) == approx([45, 0]) @pytest.mark.parametrize( @@ -83,24 +83,24 @@ def test_numpy_geodetic_isometric(): [(0, 0), (90, 90), (-90, -90), (45, 44.80768406), (-45, -44.80768406), (89, 88.99327)], ) def test_geodetic_conformal(geodetic_lat, conformal_lat): - clat = latitude.geodetic2conformal(geodetic_lat) + clat = pm.geodetic2conformal(geodetic_lat) assert clat == approx(conformal_lat) assert isinstance(clat, float) - assert latitude.geodetic2conformal(radians(geodetic_lat), deg=False) == approx( + assert pm.geodetic2conformal(radians(geodetic_lat), deg=False) == approx( radians(conformal_lat) ) - assert latitude.conformal2geodetic(conformal_lat) == approx(geodetic_lat) - assert latitude.conformal2geodetic(radians(conformal_lat), deg=False) == approx( + assert pm.conformal2geodetic(conformal_lat) == approx(geodetic_lat) + assert pm.conformal2geodetic(radians(conformal_lat), deg=False) == approx( radians(geodetic_lat) ) def test_numpy_geodetic_conformal(): pytest.importorskip("numpy") - assert latitude.geodetic2conformal([45, 0]) == approx([44.80768406, 0]) - assert latitude.conformal2geodetic([44.80768406, 0]) == approx([45, 0]) + assert pm.geodetic2conformal([45, 0]) == approx([44.80768406, 0]) + assert pm.conformal2geodetic([44.80768406, 0]) == approx([45, 0]) @pytest.mark.parametrize( @@ -108,21 +108,21 @@ def test_numpy_geodetic_conformal(): [(0, 0), (90, 90), (-90, -90), (45, 44.855682), (-45, -44.855682)], ) def test_geodetic_rectifying(geodetic_lat, rectifying_lat): - assert latitude.geodetic2rectifying(geodetic_lat) == approx(rectifying_lat) - assert latitude.geodetic2rectifying(radians(geodetic_lat), deg=False) == approx( + assert pm.geodetic2rectifying(geodetic_lat) == approx(rectifying_lat) + assert pm.geodetic2rectifying(radians(geodetic_lat), deg=False) == approx( radians(rectifying_lat) ) - assert latitude.rectifying2geodetic(rectifying_lat) == approx(geodetic_lat) - assert latitude.rectifying2geodetic(radians(rectifying_lat), deg=False) == approx( + assert pm.rectifying2geodetic(rectifying_lat) == approx(geodetic_lat) + assert pm.rectifying2geodetic(radians(rectifying_lat), deg=False) == approx( radians(geodetic_lat) ) def test_numpy_geodetic_rectifying(): pytest.importorskip("numpy") - assert latitude.geodetic2rectifying([45, 0]) == approx([44.855682, 0]) - assert latitude.rectifying2geodetic([44.855682, 0]) == approx([45, 0]) + assert pm.geodetic2rectifying([45, 0]) == approx([44.855682, 0]) + assert pm.rectifying2geodetic([44.855682, 0]) == approx([45, 0]) @pytest.mark.parametrize( @@ -130,21 +130,21 @@ def test_numpy_geodetic_rectifying(): [(0, 0), (90, 90), (-90, -90), (45, 44.87170288), (-45, -44.87170288)], ) def test_geodetic_authalic(geodetic_lat, authalic_lat): - assert latitude.geodetic2authalic(geodetic_lat) == approx(authalic_lat) - assert latitude.geodetic2authalic(radians(geodetic_lat), deg=False) == approx( + assert pm.geodetic2authalic(geodetic_lat) == approx(authalic_lat) + assert pm.geodetic2authalic(radians(geodetic_lat), deg=False) == approx( radians(authalic_lat) ) - assert latitude.authalic2geodetic(authalic_lat) == approx(geodetic_lat) - assert latitude.authalic2geodetic(radians(authalic_lat), deg=False) == approx( + assert pm.authalic2geodetic(authalic_lat) == approx(geodetic_lat) + assert pm.authalic2geodetic(radians(authalic_lat), deg=False) == approx( radians(geodetic_lat) ) def test_numpy_geodetic_authalic(): pytest.importorskip("numpy") - assert latitude.geodetic2authalic([45, 0]) == approx([44.87170288, 0]) - assert latitude.authalic2geodetic([44.87170288, 0]) == approx([45, 0]) + assert pm.geodetic2authalic([45, 0]) == approx([44.87170288, 0]) + assert pm.authalic2geodetic([44.87170288, 0]) == approx([45, 0]) @pytest.mark.parametrize( @@ -152,18 +152,18 @@ def test_numpy_geodetic_authalic(): [(0, 0), (90, 90), (-90, -90), (45, 44.9037878), (-45, -44.9037878)], ) def test_geodetic_parametric(geodetic_lat, parametric_lat): - assert latitude.geodetic2parametric(geodetic_lat) == approx(parametric_lat) - assert latitude.geodetic2parametric(radians(geodetic_lat), deg=False) == approx( + assert pm.geodetic2parametric(geodetic_lat) == approx(parametric_lat) + assert pm.geodetic2parametric(radians(geodetic_lat), deg=False) == approx( radians(parametric_lat) ) - assert latitude.parametric2geodetic(parametric_lat) == approx(geodetic_lat) - assert latitude.parametric2geodetic(radians(parametric_lat), deg=False) == approx( + assert pm.parametric2geodetic(parametric_lat) == approx(geodetic_lat) + assert pm.parametric2geodetic(radians(parametric_lat), deg=False) == approx( radians(geodetic_lat) ) def test_numpy_geodetic_parametric(): pytest.importorskip("numpy") - assert latitude.geodetic2parametric([45, 0]) == approx([44.9037878, 0]) - assert latitude.parametric2geodetic([44.9037878, 0]) == approx([45, 0]) + assert pm.geodetic2parametric([45, 0]) == approx([44.9037878, 0]) + assert pm.parametric2geodetic([44.9037878, 0]) == approx([45, 0]) diff --git a/src/pymap3d/tests/test_rcurve.py b/src/pymap3d/tests/test_rcurve.py index 60cedf5..f46482f 100644 --- a/src/pymap3d/tests/test_rcurve.py +++ b/src/pymap3d/tests/test_rcurve.py @@ -1,5 +1,4 @@ import pymap3d as pm -import pymap3d.rcurve as rcurve import pytest from pytest import approx @@ -11,12 +10,12 @@ "lat,curvature", [(0, A), (90, 0), (-90, 0), (45.0, 4517590.87884893), (-45, 4517590.87884893)] ) def test_rcurve_parallel(lat, curvature): - assert rcurve.parallel(lat) == approx(curvature, abs=1e-9, rel=1e-6) + assert pm.parallel(lat) == approx(curvature, abs=1e-9, rel=1e-6) def test_numpy_parallel(): pytest.importorskip("numpy") - assert rcurve.parallel([0, 90]) == approx([A, 0], abs=1e-9, rel=1e-6) + assert pm.parallel([0, 90]) == approx([A, 0], abs=1e-9, rel=1e-6) @pytest.mark.parametrize( @@ -30,14 +29,14 @@ def test_numpy_parallel(): ], ) def test_rcurve_meridian(lat, curvature): - assert rcurve.meridian(lat) == approx(curvature) + assert pm.meridian(lat) == approx(curvature) def test_numpy_meridian(): pytest.importorskip("numpy") - assert rcurve.meridian([0, 90]) == approx([6335439.327, 6399593.6258]) + assert pm.meridian([0, 90]) == approx([6335439.327, 6399593.6258]) def test_numpy_transverse(): pytest.importorskip("numpy") - assert rcurve.transverse([-90, 0, 90]) == approx([6399593.6258, A, 6399593.6258]) + assert pm.transverse([-90, 0, 90]) == approx([6399593.6258, A, 6399593.6258])