From a12c80fd1e347823b36ed0aeb756f61d266b1c33 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Tue, 1 Jun 2021 12:40:31 -0500
Subject: [PATCH] fix bug in spatial_filter

---
 modules/icing/pirep_goes.py | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py
index 93f222d5..8c041d21 100644
--- a/modules/icing/pirep_goes.py
+++ b/modules/icing/pirep_goes.py
@@ -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
-- 
GitLab