Skip to content

Commit

Permalink
Get the absolute value for conversions between degrees and meters (co…
Browse files Browse the repository at this point in the history
…s can be negative)
  • Loading branch information
remi-braun committed Feb 20, 2025
1 parent 7b1689f commit b3adeb0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sertit/__meta__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
Sertit Utils library
"""

__version__ = "1.46.0.dev0"
__version__ = "1.46.0.dev1"
4 changes: 2 additions & 2 deletions sertit/rasters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2063,7 +2063,7 @@ def from_deg_to_meters(
dist = float(deg) * DEG_LAT_TO_M

if lat is not None:
dist_lon = dist * np.cos(lat * DEG_2_RAD)
dist_lon = abs(dist * np.cos(lat * DEG_2_RAD))
dist = (dist + dist_lon) / 2 if average_lat_lon else dist_lon

return np.round(dist, decimals)
Expand All @@ -2090,7 +2090,7 @@ def from_meters_to_deg(
dist = float(meters) / DEG_LAT_TO_M

if lat is not None:
dist_lon = dist / np.cos(lat * DEG_2_RAD)
dist_lon = abs(dist / np.cos(lat * DEG_2_RAD))
dist = (dist + dist_lon) / 2 if average_lat_lon else dist_lon

return np.round(dist, decimals)

0 comments on commit b3adeb0

Please sign in to comment.