Skip to content

bug: LocalCartesian.reverse with lon = 1 radian #77

@ThomasGreenhill

Description

@ThomasGreenhill

There appears to be a bug in the LocalCartesian.reverse method when lat is pi/2 rad and lon is 1 rad.
PyGeodesy 23.7.12
Python 3.9.7

import numpy as np
from pygeodesy.ltp import LocalCartesian
from pygeodesy.ellipsoidalVincenty import LatLon
from pygeodesy.ltpTuples import Ned

origin_np = np.array([np.pi / 2, 1.0, 0])

origin = LatLon(np.degrees(origin_np[0]), np.degrees(origin_np[1]), height=origin_np[2])
lc = LocalCartesian(origin)
point_relative_ned_position = np.zeros(3)
point_lla = lc.reverse(Ned(point_relative_ned_position[0], point_relative_ned_position[1], point_relative_ned_position[2]))

print(point_lla.toLatLon())

The result is:
(90.0, 0.0, 0.0, Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Transforms.WGS84))

Whereas it should be:
(90.0, 57.3, 0.0, Datum(name='WGS84', ellipsoid=Ellipsoids.WGS84, transform=Transforms.WGS84))

Without looking into the details of the implementation, I'd guess python is interpreting 1.0 as True somewhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions