1
1
from math import inf , radians
2
2
3
- import pymap3d . latitude as latitude
3
+ import pymap3d as pm
4
4
import pymap3d .rcurve as rcurve
5
5
import pytest
6
6
from pytest import approx
11
11
[(0 , 0 , 0 ), (90 , 0 , 90 ), (- 90 , 0 , - 90 ), (45 , 0 , 44.80757678 ), (- 45 , 0 , - 44.80757678 )],
12
12
)
13
13
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 )
15
15
16
16
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 )
20
20
)
21
21
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 )
24
24
)
25
25
26
26
@@ -29,21 +29,21 @@ def test_geodetic_alt_geocentric(geodetic_lat, alt_m, geocentric_lat):
29
29
[(0 , 0 ), (90 , 90 ), (- 90 , - 90 ), (45 , 44.80757678 ), (- 45 , - 44.80757678 )],
30
30
)
31
31
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 (
34
34
radians (geocentric_lat )
35
35
)
36
36
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 (
39
39
radians (geodetic_lat )
40
40
)
41
41
42
42
43
43
def test_numpy_geodetic_geocentric ():
44
44
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 ])
47
47
48
48
49
49
@pytest .mark .parametrize (
@@ -58,112 +58,112 @@ def test_numpy_geodetic_geocentric():
58
58
],
59
59
)
60
60
def test_geodetic_isometric (geodetic_lat , isometric_lat ):
61
- isolat = latitude .geodetic2isometric (geodetic_lat )
61
+ isolat = pm .geodetic2isometric (geodetic_lat )
62
62
assert isolat == approx (isometric_lat )
63
63
assert isinstance (isolat , float )
64
64
65
- assert latitude .geodetic2isometric (radians (geodetic_lat ), deg = False ) == approx (
65
+ assert pm .geodetic2isometric (radians (geodetic_lat ), deg = False ) == approx (
66
66
radians (isometric_lat )
67
67
)
68
68
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 (
71
71
radians (geodetic_lat )
72
72
)
73
73
74
74
75
75
def test_numpy_geodetic_isometric ():
76
76
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 ])
79
79
80
80
81
81
@pytest .mark .parametrize (
82
82
"geodetic_lat,conformal_lat" ,
83
83
[(0 , 0 ), (90 , 90 ), (- 90 , - 90 ), (45 , 44.80768406 ), (- 45 , - 44.80768406 ), (89 , 88.99327 )],
84
84
)
85
85
def test_geodetic_conformal (geodetic_lat , conformal_lat ):
86
- clat = latitude .geodetic2conformal (geodetic_lat )
86
+ clat = pm .geodetic2conformal (geodetic_lat )
87
87
assert clat == approx (conformal_lat )
88
88
assert isinstance (clat , float )
89
89
90
- assert latitude .geodetic2conformal (radians (geodetic_lat ), deg = False ) == approx (
90
+ assert pm .geodetic2conformal (radians (geodetic_lat ), deg = False ) == approx (
91
91
radians (conformal_lat )
92
92
)
93
93
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 (
96
96
radians (geodetic_lat )
97
97
)
98
98
99
99
100
100
def test_numpy_geodetic_conformal ():
101
101
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 ])
104
104
105
105
106
106
@pytest .mark .parametrize (
107
107
"geodetic_lat,rectifying_lat" ,
108
108
[(0 , 0 ), (90 , 90 ), (- 90 , - 90 ), (45 , 44.855682 ), (- 45 , - 44.855682 )],
109
109
)
110
110
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 (
113
113
radians (rectifying_lat )
114
114
)
115
115
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 (
118
118
radians (geodetic_lat )
119
119
)
120
120
121
121
122
122
def test_numpy_geodetic_rectifying ():
123
123
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 ])
126
126
127
127
128
128
@pytest .mark .parametrize (
129
129
"geodetic_lat,authalic_lat" ,
130
130
[(0 , 0 ), (90 , 90 ), (- 90 , - 90 ), (45 , 44.87170288 ), (- 45 , - 44.87170288 )],
131
131
)
132
132
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 (
135
135
radians (authalic_lat )
136
136
)
137
137
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 (
140
140
radians (geodetic_lat )
141
141
)
142
142
143
143
144
144
def test_numpy_geodetic_authalic ():
145
145
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 ])
148
148
149
149
150
150
@pytest .mark .parametrize (
151
151
"geodetic_lat,parametric_lat" ,
152
152
[(0 , 0 ), (90 , 90 ), (- 90 , - 90 ), (45 , 44.9037878 ), (- 45 , - 44.9037878 )],
153
153
)
154
154
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 (
157
157
radians (parametric_lat )
158
158
)
159
159
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 (
162
162
radians (geodetic_lat )
163
163
)
164
164
165
165
166
166
def test_numpy_geodetic_parametric ():
167
167
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