Skip to content
Snippets Groups Projects
Commit a12c80fd authored by tomrink's avatar tomrink
Browse files

fix bug in spatial_filter

parent e1e35f4f
Branches
No related tags found
No related merge requests found
......@@ -1335,22 +1335,22 @@ def spatial_filter(icing_dict):
grd_x_hi = lon_space.shape[0] - 1
grd_y_hi = lat_space.shape[0] - 1
for key in keys:
grd_bins = np.full((lat_space.shape[0], lon_space.shape[0]), 0)
grd_bins = np.full((lat_space.shape[0], lon_space.shape[0]), 0)
tup = icing_dict.get(key)
lat = tup[0]
lon = tup[1]
for key in keys:
rpts = icing_dict.get(key)
for tup in rpts:
lat = tup[0]
lon = tup[1]
lon_idx = np.searchsorted(lon_space, lon)
lat_idx = np.searchsorted(lat_space, lat)
lon_idx = np.searchsorted(lon_space, lon)
lat_idx = np.searchsorted(lat_space, lat)
if lon_idx < 0 or lon_idx > grd_x_hi:
continue
if lat_idx < 0 or lat_idx > grd_y_hi:
continue
if lon_idx < 0 or lon_idx > grd_x_hi:
continue
if lat_idx < 0 or lat_idx > grd_y_hi:
continue
grd_bins[lat_idx, lon_idx] += 1
grd_bins[lat_idx, lon_idx] += 1
return grd_bins
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment