Skip to content

Commit 81fe008

Browse files
committed
restore import of .latitude and .rcurve
Python import mechanism and computers are faster now than several years ago fixes #97
1 parent 4df1d2c commit 81fe008

File tree

3 files changed

+85
-49
lines changed

3 files changed

+85
-49
lines changed

src/pymap3d/__init__.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,25 @@
5858
from .spherical import geodetic2spherical, spherical2geodetic
5959
from .timeconv import str2dt
6060

61+
from .latitude import (
62+
geodetic2isometric,
63+
isometric2geodetic,
64+
geodetic2rectifying,
65+
rectifying2geodetic,
66+
geodetic2conformal,
67+
conformal2geodetic,
68+
geodetic2parametric,
69+
parametric2geodetic,
70+
geodetic2geocentric,
71+
geocentric2geodetic,
72+
geodetic2authalic,
73+
authalic2geodetic,
74+
geod2geoc,
75+
geoc2geod,
76+
)
77+
78+
from .rcurve import parallel, meridian, transverse, geocentric_radius
79+
6180
__all__ = [
6281
"aer2ecef",
6382
"aer2geodetic",
@@ -92,6 +111,24 @@
92111
"str2dt",
93112
"azel2radec",
94113
"radec2azel",
114+
"parallel",
115+
"meridian",
116+
"transverse",
117+
"geocentric_radius",
118+
"geodetic2isometric",
119+
"isometric2geodetic",
120+
"geodetic2rectifying",
121+
"rectifying2geodetic",
122+
"geodetic2conformal",
123+
"conformal2geodetic",
124+
"geodetic2parametric",
125+
"parametric2geodetic",
126+
"geodetic2geocentric",
127+
"geocentric2geodetic",
128+
"geodetic2authalic",
129+
"authalic2geodetic",
130+
"geod2geoc",
131+
"geoc2geod",
95132
]
96133

97134
try:

src/pymap3d/tests/test_latitude.py

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from math import inf, radians
22

3-
import pymap3d.latitude as latitude
3+
import pymap3d as pm
44
import pymap3d.rcurve as rcurve
55
import pytest
66
from pytest import approx
@@ -11,16 +11,16 @@
1111
[(0, 0, 0), (90, 0, 90), (-90, 0, -90), (45, 0, 44.80757678), (-45, 0, -44.80757678)],
1212
)
1313
def test_geodetic_alt_geocentric(geodetic_lat, alt_m, geocentric_lat):
14-
assert latitude.geod2geoc(geodetic_lat, alt_m) == approx(geocentric_lat)
14+
assert pm.geod2geoc(geodetic_lat, alt_m) == approx(geocentric_lat)
1515

1616
r = rcurve.geocentric_radius(geodetic_lat)
17-
assert latitude.geoc2geod(geocentric_lat, r) == approx(geodetic_lat)
18-
assert latitude.geoc2geod(geocentric_lat, 1e5 + r) == approx(
19-
latitude.geocentric2geodetic(geocentric_lat, 1e5 + alt_m)
17+
assert pm.geoc2geod(geocentric_lat, r) == approx(geodetic_lat)
18+
assert pm.geoc2geod(geocentric_lat, 1e5 + r) == approx(
19+
pm.geocentric2geodetic(geocentric_lat, 1e5 + alt_m)
2020
)
2121

22-
assert latitude.geod2geoc(geodetic_lat, 1e5 + alt_m) == approx(
23-
latitude.geodetic2geocentric(geodetic_lat, 1e5 + alt_m)
22+
assert pm.geod2geoc(geodetic_lat, 1e5 + alt_m) == approx(
23+
pm.geodetic2geocentric(geodetic_lat, 1e5 + alt_m)
2424
)
2525

2626

@@ -29,21 +29,21 @@ def test_geodetic_alt_geocentric(geodetic_lat, alt_m, geocentric_lat):
2929
[(0, 0), (90, 90), (-90, -90), (45, 44.80757678), (-45, -44.80757678)],
3030
)
3131
def test_geodetic_geocentric(geodetic_lat, geocentric_lat):
32-
assert latitude.geodetic2geocentric(geodetic_lat, 0) == approx(geocentric_lat)
33-
assert latitude.geodetic2geocentric(radians(geodetic_lat), 0, deg=False) == approx(
32+
assert pm.geodetic2geocentric(geodetic_lat, 0) == approx(geocentric_lat)
33+
assert pm.geodetic2geocentric(radians(geodetic_lat), 0, deg=False) == approx(
3434
radians(geocentric_lat)
3535
)
3636

37-
assert latitude.geocentric2geodetic(geocentric_lat, 0) == approx(geodetic_lat)
38-
assert latitude.geocentric2geodetic(radians(geocentric_lat), 0, deg=False) == approx(
37+
assert pm.geocentric2geodetic(geocentric_lat, 0) == approx(geodetic_lat)
38+
assert pm.geocentric2geodetic(radians(geocentric_lat), 0, deg=False) == approx(
3939
radians(geodetic_lat)
4040
)
4141

4242

4343
def test_numpy_geodetic_geocentric():
4444
pytest.importorskip("numpy")
45-
assert latitude.geodetic2geocentric([45, 0], 0) == approx([44.80757678, 0])
46-
assert latitude.geocentric2geodetic([44.80757678, 0], 0) == approx([45, 0])
45+
assert pm.geodetic2geocentric([45, 0], 0) == approx([44.80757678, 0])
46+
assert pm.geocentric2geodetic([44.80757678, 0], 0) == approx([45, 0])
4747

4848

4949
@pytest.mark.parametrize(
@@ -58,112 +58,112 @@ def test_numpy_geodetic_geocentric():
5858
],
5959
)
6060
def test_geodetic_isometric(geodetic_lat, isometric_lat):
61-
isolat = latitude.geodetic2isometric(geodetic_lat)
61+
isolat = pm.geodetic2isometric(geodetic_lat)
6262
assert isolat == approx(isometric_lat)
6363
assert isinstance(isolat, float)
6464

65-
assert latitude.geodetic2isometric(radians(geodetic_lat), deg=False) == approx(
65+
assert pm.geodetic2isometric(radians(geodetic_lat), deg=False) == approx(
6666
radians(isometric_lat)
6767
)
6868

69-
assert latitude.isometric2geodetic(isometric_lat) == approx(geodetic_lat)
70-
assert latitude.isometric2geodetic(radians(isometric_lat), deg=False) == approx(
69+
assert pm.isometric2geodetic(isometric_lat) == approx(geodetic_lat)
70+
assert pm.isometric2geodetic(radians(isometric_lat), deg=False) == approx(
7171
radians(geodetic_lat)
7272
)
7373

7474

7575
def test_numpy_geodetic_isometric():
7676
pytest.importorskip("numpy")
77-
assert latitude.geodetic2isometric([45, 0]) == approx([50.227466, 0])
78-
assert latitude.isometric2geodetic([50.227466, 0]) == approx([45, 0])
77+
assert pm.geodetic2isometric([45, 0]) == approx([50.227466, 0])
78+
assert pm.isometric2geodetic([50.227466, 0]) == approx([45, 0])
7979

8080

8181
@pytest.mark.parametrize(
8282
"geodetic_lat,conformal_lat",
8383
[(0, 0), (90, 90), (-90, -90), (45, 44.80768406), (-45, -44.80768406), (89, 88.99327)],
8484
)
8585
def test_geodetic_conformal(geodetic_lat, conformal_lat):
86-
clat = latitude.geodetic2conformal(geodetic_lat)
86+
clat = pm.geodetic2conformal(geodetic_lat)
8787
assert clat == approx(conformal_lat)
8888
assert isinstance(clat, float)
8989

90-
assert latitude.geodetic2conformal(radians(geodetic_lat), deg=False) == approx(
90+
assert pm.geodetic2conformal(radians(geodetic_lat), deg=False) == approx(
9191
radians(conformal_lat)
9292
)
9393

94-
assert latitude.conformal2geodetic(conformal_lat) == approx(geodetic_lat)
95-
assert latitude.conformal2geodetic(radians(conformal_lat), deg=False) == approx(
94+
assert pm.conformal2geodetic(conformal_lat) == approx(geodetic_lat)
95+
assert pm.conformal2geodetic(radians(conformal_lat), deg=False) == approx(
9696
radians(geodetic_lat)
9797
)
9898

9999

100100
def test_numpy_geodetic_conformal():
101101
pytest.importorskip("numpy")
102-
assert latitude.geodetic2conformal([45, 0]) == approx([44.80768406, 0])
103-
assert latitude.conformal2geodetic([44.80768406, 0]) == approx([45, 0])
102+
assert pm.geodetic2conformal([45, 0]) == approx([44.80768406, 0])
103+
assert pm.conformal2geodetic([44.80768406, 0]) == approx([45, 0])
104104

105105

106106
@pytest.mark.parametrize(
107107
"geodetic_lat,rectifying_lat",
108108
[(0, 0), (90, 90), (-90, -90), (45, 44.855682), (-45, -44.855682)],
109109
)
110110
def test_geodetic_rectifying(geodetic_lat, rectifying_lat):
111-
assert latitude.geodetic2rectifying(geodetic_lat) == approx(rectifying_lat)
112-
assert latitude.geodetic2rectifying(radians(geodetic_lat), deg=False) == approx(
111+
assert pm.geodetic2rectifying(geodetic_lat) == approx(rectifying_lat)
112+
assert pm.geodetic2rectifying(radians(geodetic_lat), deg=False) == approx(
113113
radians(rectifying_lat)
114114
)
115115

116-
assert latitude.rectifying2geodetic(rectifying_lat) == approx(geodetic_lat)
117-
assert latitude.rectifying2geodetic(radians(rectifying_lat), deg=False) == approx(
116+
assert pm.rectifying2geodetic(rectifying_lat) == approx(geodetic_lat)
117+
assert pm.rectifying2geodetic(radians(rectifying_lat), deg=False) == approx(
118118
radians(geodetic_lat)
119119
)
120120

121121

122122
def test_numpy_geodetic_rectifying():
123123
pytest.importorskip("numpy")
124-
assert latitude.geodetic2rectifying([45, 0]) == approx([44.855682, 0])
125-
assert latitude.rectifying2geodetic([44.855682, 0]) == approx([45, 0])
124+
assert pm.geodetic2rectifying([45, 0]) == approx([44.855682, 0])
125+
assert pm.rectifying2geodetic([44.855682, 0]) == approx([45, 0])
126126

127127

128128
@pytest.mark.parametrize(
129129
"geodetic_lat,authalic_lat",
130130
[(0, 0), (90, 90), (-90, -90), (45, 44.87170288), (-45, -44.87170288)],
131131
)
132132
def test_geodetic_authalic(geodetic_lat, authalic_lat):
133-
assert latitude.geodetic2authalic(geodetic_lat) == approx(authalic_lat)
134-
assert latitude.geodetic2authalic(radians(geodetic_lat), deg=False) == approx(
133+
assert pm.geodetic2authalic(geodetic_lat) == approx(authalic_lat)
134+
assert pm.geodetic2authalic(radians(geodetic_lat), deg=False) == approx(
135135
radians(authalic_lat)
136136
)
137137

138-
assert latitude.authalic2geodetic(authalic_lat) == approx(geodetic_lat)
139-
assert latitude.authalic2geodetic(radians(authalic_lat), deg=False) == approx(
138+
assert pm.authalic2geodetic(authalic_lat) == approx(geodetic_lat)
139+
assert pm.authalic2geodetic(radians(authalic_lat), deg=False) == approx(
140140
radians(geodetic_lat)
141141
)
142142

143143

144144
def test_numpy_geodetic_authalic():
145145
pytest.importorskip("numpy")
146-
assert latitude.geodetic2authalic([45, 0]) == approx([44.87170288, 0])
147-
assert latitude.authalic2geodetic([44.87170288, 0]) == approx([45, 0])
146+
assert pm.geodetic2authalic([45, 0]) == approx([44.87170288, 0])
147+
assert pm.authalic2geodetic([44.87170288, 0]) == approx([45, 0])
148148

149149

150150
@pytest.mark.parametrize(
151151
"geodetic_lat,parametric_lat",
152152
[(0, 0), (90, 90), (-90, -90), (45, 44.9037878), (-45, -44.9037878)],
153153
)
154154
def test_geodetic_parametric(geodetic_lat, parametric_lat):
155-
assert latitude.geodetic2parametric(geodetic_lat) == approx(parametric_lat)
156-
assert latitude.geodetic2parametric(radians(geodetic_lat), deg=False) == approx(
155+
assert pm.geodetic2parametric(geodetic_lat) == approx(parametric_lat)
156+
assert pm.geodetic2parametric(radians(geodetic_lat), deg=False) == approx(
157157
radians(parametric_lat)
158158
)
159159

160-
assert latitude.parametric2geodetic(parametric_lat) == approx(geodetic_lat)
161-
assert latitude.parametric2geodetic(radians(parametric_lat), deg=False) == approx(
160+
assert pm.parametric2geodetic(parametric_lat) == approx(geodetic_lat)
161+
assert pm.parametric2geodetic(radians(parametric_lat), deg=False) == approx(
162162
radians(geodetic_lat)
163163
)
164164

165165

166166
def test_numpy_geodetic_parametric():
167167
pytest.importorskip("numpy")
168-
assert latitude.geodetic2parametric([45, 0]) == approx([44.9037878, 0])
169-
assert latitude.parametric2geodetic([44.9037878, 0]) == approx([45, 0])
168+
assert pm.geodetic2parametric([45, 0]) == approx([44.9037878, 0])
169+
assert pm.parametric2geodetic([44.9037878, 0]) == approx([45, 0])

src/pymap3d/tests/test_rcurve.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import pymap3d as pm
2-
import pymap3d.rcurve as rcurve
32
import pytest
43
from pytest import approx
54

@@ -11,12 +10,12 @@
1110
"lat,curvature", [(0, A), (90, 0), (-90, 0), (45.0, 4517590.87884893), (-45, 4517590.87884893)]
1211
)
1312
def test_rcurve_parallel(lat, curvature):
14-
assert rcurve.parallel(lat) == approx(curvature, abs=1e-9, rel=1e-6)
13+
assert pm.parallel(lat) == approx(curvature, abs=1e-9, rel=1e-6)
1514

1615

1716
def test_numpy_parallel():
1817
pytest.importorskip("numpy")
19-
assert rcurve.parallel([0, 90]) == approx([A, 0], abs=1e-9, rel=1e-6)
18+
assert pm.parallel([0, 90]) == approx([A, 0], abs=1e-9, rel=1e-6)
2019

2120

2221
@pytest.mark.parametrize(
@@ -30,14 +29,14 @@ def test_numpy_parallel():
3029
],
3130
)
3231
def test_rcurve_meridian(lat, curvature):
33-
assert rcurve.meridian(lat) == approx(curvature)
32+
assert pm.meridian(lat) == approx(curvature)
3433

3534

3635
def test_numpy_meridian():
3736
pytest.importorskip("numpy")
38-
assert rcurve.meridian([0, 90]) == approx([6335439.327, 6399593.6258])
37+
assert pm.meridian([0, 90]) == approx([6335439.327, 6399593.6258])
3938

4039

4140
def test_numpy_transverse():
4241
pytest.importorskip("numpy")
43-
assert rcurve.transverse([-90, 0, 90]) == approx([6399593.6258, A, 6399593.6258])
42+
assert pm.transverse([-90, 0, 90]) == approx([6399593.6258, A, 6399593.6258])

0 commit comments

Comments
 (0)