Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ioshchepkov committed Apr 3, 2021
1 parent 1ab2e08 commit c15b565
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pygeoid/coordinates/position.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions pygeoid/coordinates/test/test_position.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions pygeoid/coordinates/test/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions pygeoid/coordinates/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c15b565

Please sign in to comment.