Skip to content

Commit

Permalink
Fix doctest.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmarmo committed May 19, 2023
1 parent 366ac81 commit d3f53fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions astropy/coordinates/representation/geodetic.py
Expand Up @@ -147,7 +147,6 @@ def from_cartesian(cls, cart):
lon, lat, height = erfa.gc2gde(
cls._equatorial_radius, cls._flattening, cart.get_xyz(xyz_axis=-1)
)
lon = _compute_longitude(lon, cls._positive_longitude, cls._wrap_angle)
if not cls._ographic:

Check warning on line 150 in astropy/coordinates/representation/geodetic.py

View check run for this annotation

Codecov / codecov/patch

astropy/coordinates/representation/geodetic.py#L150

Added line #L150 was not covered by tests
# Compute planetocentric angles
xyz = cart.get_xyz()

Check warning on line 152 in astropy/coordinates/representation/geodetic.py

View check run for this annotation

Codecov / codecov/patch

astropy/coordinates/representation/geodetic.py#L152

Added line #L152 was not covered by tests
Expand All @@ -167,8 +166,8 @@ def from_cartesian(cls, cart):
(d - r_spheroid),
(np.abs(xyz[2]) - np.abs(z_spheroid)),
)

return cls(lon, lat, height, copy=False)
lon = _compute_longitude(lon, cls._positive_longitude, cls._wrap_angle)
return cls(lon, lat.to(u.deg), height, copy=False)

Check warning on line 170 in astropy/coordinates/representation/geodetic.py

View check run for this annotation

Codecov / codecov/patch

astropy/coordinates/representation/geodetic.py#L169-L170

Added lines #L169 - L170 were not covered by tests


@format_doc(geodetic_base_doc)
Expand Down
4 changes: 2 additions & 2 deletions docs/whatsnew/6.0.rst
Expand Up @@ -44,8 +44,8 @@ bodies by subclassing `~astropy.coordinates.BaseGeodeticRepresentation` and defi
<CartesianRepresentation (x, y, z) in m
(2481112.60371134, 2554647.09482601, 5274064.55958489)>
>>> representation.represent_as(WGS84GeodeticRepresentation) # doctest: +FLOAT_CMP
<WGS84GeodeticRepresentation (lon, lat, height) in (rad, rad, m)
(0.79999959, 0.98000063, 370.01796023)>
<WGS84GeodeticRepresentation (lon, lat, height) in (deg, deg, m)
(45.8366, 56.14990022, 370.01796023)>

See :ref:`astropy-coordinates-create-geodetic` for more details.

Expand Down

0 comments on commit d3f53fd

Please sign in to comment.