Skip to content

Commit

Permalink
Fixed numpy divide by zero error converting ECEF for multiple locations.
Browse files Browse the repository at this point in the history
After the change in commit dde1b9 to use isclose(), this now fails with the
following exception when trying to convert multiple locations (len(z) > 1) and
one or more of them has a divide-by-zero error:
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()
  • Loading branch information
adamshapiro0 authored and scivision committed Nov 15, 2023
1 parent 9310f62 commit e847c32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pymap3d/ecef.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def ecef2geodetic(
warnings.simplefilter("error")
Beta = atan(huE / u * z / hypot(x, y))
except (ArithmeticError, RuntimeWarning):
if isclose(z, 0):
if any(isclose(z, 0)):
Beta = 0
elif z > 0:
Beta = pi / 2
Expand Down

0 comments on commit e847c32

Please sign in to comment.