File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -88,8 +88,7 @@ def geodetic2ecef(
8888 N = ell .semimajor_axis ** 2 / sqrt (
8989 ell .semimajor_axis ** 2 * cos (lat ) ** 2 + ell .semiminor_axis ** 2 * sin (lat ) ** 2
9090 )
91- # Compute cartesian (geocentric) coordinates given (curvilinear) geodetic
92- # coordinates.
91+ # Compute cartesian (geocentric) coordinates given (curvilinear) geodetic coordinates.
9392 x = (N + alt ) * cos (lat ) * cos (lon )
9493 y = (N + alt ) * cos (lat ) * sin (lon )
9594 z = (N * (ell .semiminor_axis / ell .semimajor_axis ) ** 2 + alt ) * sin (lat )
Original file line number Diff line number Diff line change @@ -240,3 +240,21 @@ def test_numpy_ecef2geodetic(xyz, lla):
240240 assert lat [0 ] == approx (lla [0 ])
241241 assert lon [0 ] == approx (lla [1 ])
242242 assert alt [0 ] == approx (lla [2 ])
243+
244+
245+ @pytest .mark .parametrize ("lla, xyz" , llaxyz )
246+ def test_numpy_geodetic2ecef (lla , xyz ):
247+ np = pytest .importorskip ("numpy" )
248+ x , y , z = pm .geodetic2ecef (
249+ * np .array (
250+ [
251+ [lla ],
252+ ],
253+ dtype = np .float32 ,
254+ ).T
255+ )
256+
257+ atol_dist = 1 # meters
258+ assert x [0 ] == approx (xyz [0 ], abs = atol_dist )
259+ assert y [0 ] == approx (xyz [1 ], abs = atol_dist )
260+ assert z [0 ] == approx (xyz [2 ], abs = atol_dist )
You can’t perform that action at this time.
0 commit comments