File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 8888def 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
You can’t perform that action at this time.
0 commit comments