Skip to content

Commit d3aea1e

Browse files
committed
Add test for geocoords in convert_wgs_to_utm
1 parent df439a5 commit d3aea1e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

climada/util/coordinates.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,11 @@ def convert_wgs_to_utm(lon, lat):
527527
epsg_code : int
528528
EPSG code of UTM projection.
529529
"""
530+
if not check_if_geo_coords(lat, lon):
531+
raise ValueError(
532+
"Input lat and lon coordinates are not geographic "
533+
"or have total extents > 180° for lat or > 360° for lon."
534+
)
530535
epsg_utm_base = 32601 + (0 if lat >= 0 else 100)
531536
return epsg_utm_base + (math.floor((lon + 180) / 6) % 60)
532537

0 commit comments

Comments
 (0)