11from math import inf , radians
22
3- import pymap3d . latitude as latitude
3+ import pymap3d as pm
44import pymap3d .rcurve as rcurve
55import pytest
66from pytest import approx
1111 [(0 , 0 , 0 ), (90 , 0 , 90 ), (- 90 , 0 , - 90 ), (45 , 0 , 44.80757678 ), (- 45 , 0 , - 44.80757678 )],
1212)
1313def 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)
3131def 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
4343def 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)
6060def 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
7575def 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)
8585def 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
100100def 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)
110110def 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
122122def 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)
132132def 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
144144def 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)
154154def 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
166166def 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 ])
0 commit comments