File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 7979"""Distance threshold in km for coordinate assignment. Nearest neighbors with greater distances
8080are not considered."""
8181
82+ def check_if_geo_coords (lat , lon ):
83+ """
84+ Check if latitude and longitude arrays are likely in geographic coordinates,
85+ testing if min/max values are within -90 to 180 for latitude and -180 to 360
86+ for longitude.
87+ Returns True if lat/lon ranges are in the geographic coordinates range, otherwise False.
88+ """
89+ lat = np .array (lat )
90+ lon = np .array (lon )
91+
92+ # Check if latitude is within -90 to 180 and longitude is within -180 to 360
93+ # and extent are smaller than 180 and 360 respectively
94+ if ((lat .min () >= - 90 and lat .max () <= 180 and lon .min () >= - 180 and lon .max () <= 360 )
95+ and (lat .max () - lat .min () <= 180 and lon .max () - lon .min () <= 360 )):
96+ return True
97+ else :
98+ return False
99+
82100def latlon_to_geosph_vector (lat , lon , rad = False , basis = False ):
83101 """Convert lat/lon coodinates to radial vectors (on geosphere)
84102
You can’t perform that action at this time.
0 commit comments