Skip to content

Commit 8231aaa

Browse files
committed
Added some security on lat and lon ranges
1 parent 7423428 commit 8231aaa

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

python/extpar_art_to_buffer.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,10 @@ def get_fraction_per_soil_type(soil_id):
164164
vlons = np.array(tg.vlons)
165165
vlats = np.array(tg.vlats)
166166

167-
lon_min = np.min(vlons)
168-
lon_max = np.max(vlons)
169-
lat_min = np.min(vlats)
170-
lat_max = np.max(vlats)
171-
172-
print("LON MIN", lon_min)
173-
print("LON MAX", lon_max)
174-
print("LAT MIN", lat_min)
175-
print("LAT MAX", lat_max)
167+
lon_min = max(np.min(vlons), -180.0)
168+
lon_max = min(np.max(vlons), 180.0)
169+
lat_min = max(np.min(vlats), -90.0)
170+
lat_max = min(np.max(vlats), 90.0)
176171

177172
lon_mask = (raw_lon >= lon_min) & (raw_lon <= lon_max)
178173
lat_mask = (raw_lat >= lat_min) & (raw_lat <= lat_max)

0 commit comments

Comments
 (0)