From c15b5659768f1e07f8eb89811a2bf7c85da9c22b Mon Sep 17 00:00:00 2001 From: Ilya Oshchepkov Date: Sat, 3 Apr 2021 15:42:01 +0300 Subject: [PATCH] fix tests --- pygeoid/coordinates/position.py | 4 ++-- pygeoid/coordinates/test/test_position.py | 4 ++-- pygeoid/coordinates/test/test_transform.py | 8 ++++---- pygeoid/coordinates/transform.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pygeoid/coordinates/position.py b/pygeoid/coordinates/position.py index f24b128..380f0d6 100644 --- a/pygeoid/coordinates/position.py +++ b/pygeoid/coordinates/position.py @@ -155,9 +155,9 @@ def ellipsoidal(self, ell): u_ax : ~astropy.units.Quantity Polar axis of the ellipsoid passing through the given point. """ - rlat, lon, u = transform.cartesian_to_ellipsoidal( + rlat, lon, u_ax = transform.cartesian_to_ellipsoidal( self._x, self._y, self._z, ell=ell) - return rlat, lon, u + return rlat, lon, u_ax @u.quantity_input def enu(self, origin: tuple[u.deg, u.deg, u.m], ell=None): diff --git a/pygeoid/coordinates/test/test_position.py b/pygeoid/coordinates/test/test_position.py index 82f4481..41838c4 100644 --- a/pygeoid/coordinates/test/test_position.py +++ b/pygeoid/coordinates/test/test_position.py @@ -49,8 +49,8 @@ def test_from_to_ellipsoidal(): z_ = np.ma.masked_where(cond, z).compressed() p = Position3D(x_, y_, z_) - rlat, lon, u = p.ellipsoidal(ell=ell) - b_x, b_y, b_z = Position3D.from_ellipsoidal(rlat, lon, u, + rlat, lon, u_ax = p.ellipsoidal(ell=ell) + b_x, b_y, b_z = Position3D.from_ellipsoidal(rlat, lon, u_ax, ell=ell).cartesian np.testing.assert_array_almost_equal([b_x.value, b_y.value, b_z.value], [x_.value, y_.value, z_.value], decimal=5) diff --git a/pygeoid/coordinates/test/test_transform.py b/pygeoid/coordinates/test/test_transform.py index fd012bc..8dc0978 100644 --- a/pygeoid/coordinates/test/test_transform.py +++ b/pygeoid/coordinates/test/test_transform.py @@ -50,8 +50,8 @@ def test_cartesian_to_ellipsoidal_and_back(): y_ = np.ma.masked_where(cond, y).compressed() z_ = np.ma.masked_where(cond, z).compressed() - rlat, lon, u = cartesian_to_ellipsoidal(x_, y_, z_, ell) - b_x, b_y, b_z = ellipsoidal_to_cartesian(rlat, lon, u, ell) + rlat, lon, u_ax = cartesian_to_ellipsoidal(x_, y_, z_, ell) + b_x, b_y, b_z = ellipsoidal_to_cartesian(rlat, lon, u_ax, ell) np.testing.assert_array_almost_equal(b_x.value, x_.value, decimal=5) np.testing.assert_array_almost_equal(b_y.value, y_.value, decimal=5) @@ -82,12 +82,12 @@ def test_geodetic_to_elliposidal_and_back(): lat, lon, height = cartesian_to_geodetic(x_, y_, z_, ell) - rlat, ell_lon, u = geodetic_to_ellipsoidal(lat, lon, height, ell) + rlat, ell_lon, u_ax = geodetic_to_ellipsoidal(lat, lon, height, ell) np.testing.assert_array_almost_equal( ell_lon.to('degree').value, lon.to('degree').value, decimal=9) - b_lat, b_lon, b_height = ellipsoidal_to_geodetic(rlat, ell_lon, u, ell) + b_lat, b_lon, b_height = ellipsoidal_to_geodetic(rlat, ell_lon, u_ax, ell) np.testing.assert_array_almost_equal(b_lat.to('degree').value, lat.to('degree').value, decimal=9) np.testing.assert_array_almost_equal(b_lon.to('degree').value, lon.to('degree').value, decimal=9) diff --git a/pygeoid/coordinates/transform.py b/pygeoid/coordinates/transform.py index ade3a1a..f3c8dd2 100644 --- a/pygeoid/coordinates/transform.py +++ b/pygeoid/coordinates/transform.py @@ -283,7 +283,7 @@ def ellipsoidal_to_cartesian(rlat: u.deg, lon: u.deg, u_ax: u.m, ell): x = k * _np.cos(rlat) * _np.cos(lon) y = k * _np.cos(rlat) * _np.sin(lon) - z = u * _np.sin(rlat) + z = u_ax * _np.sin(rlat) return x, y, z @@ -392,7 +392,7 @@ def ellipsoidal_to_geodetic(rlat: u.deg, lon: u.deg, u_ax: u.m, ell): Geodetic height. """ return cartesian_to_geodetic( - *ellipsoidal_to_cartesian(rlat, lon, u, ell=ell), ell=ell) + *ellipsoidal_to_cartesian(rlat, lon, u_ax, ell=ell), ell=ell) @u.quantity_input