Skip to content

Commit 320d0f7

Browse files
committed
Extend allowed extent for geo coords
1 parent c8aac80 commit 320d0f7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

climada/util/coordinates.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,21 @@
8888
def check_if_geo_coords(lat, lon):
8989
"""
9090
Check if latitude and longitude arrays are likely in geographic coordinates,
91-
testing if min/max values are within -90 to 180 for latitude and -180 to 360
91+
testing if min/max values are within -180 to 180 for latitude and -360 to 360
9292
for longitude.
9393
Returns True if lat/lon ranges are in the geographic coordinates range, otherwise False.
9494
"""
9595
lat = np.array(lat)
9696
lon = np.array(lon)
9797

98-
# Check if latitude is within -90 to 180 and longitude is within -180 to 360
98+
# Check if latitude is within -180 to 180 and longitude is within -360 to 360
9999
# and extent are smaller than 180 and 360 respectively
100100
if (
101-
lat.min() >= -90 and lat.max() <= 180 and lon.min() >= -180 and lon.max() <= 360
102-
) and (lat.max() - lat.min() <= 180 and lon.max() - lon.min() <= 360):
101+
lat.min() >= -180
102+
and lat.max() <= 180
103+
and lon.min() >= -360
104+
and lon.max() <= 360
105+
) and ((lat.max() - lat.min()) <= 180 and (lon.max() - lon.min()) <= 360):
103106
return True
104107
else:
105108
return False

0 commit comments

Comments
 (0)