From 528518448b75f18cc1046991e4b34858d968d75d Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Wed, 1 Sep 2021 11:00:22 -0500
Subject: [PATCH] snapshot...

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

diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py
index 8ea9597f..d1a45c30 100644
--- a/modules/icing/pirep_goes.py
+++ b/modules/icing/pirep_goes.py
@@ -1058,10 +1058,18 @@ def make_ts_bins():
 
 
 keep_out_edges = make_ts_bins()
+keep_out_edges = np.array(keep_out_edges)
+
+
+def check_times(ts):
+    bidx = (find_bin_index(keep_out_edges, np.array([ts])))[0]
+    if bidx != -1 and bidx % 2 == 0:
+        return True
+    return False
 
 
 def tile_extract(trnfile='/home/rink/tiles_l1b_train.h5', tstfile='/home/rink/tiles_l1b_test.h5', L1B_or_L2='L1B',
-                 cld_mask_name='cloud_mask', augment=False, split=0.2):
+                 cld_mask_name='cloud_mask', augment=False, split=0.2, check_keep_out=False):
     icing_int_s = []
     ice_time_s = []
     no_ice_time_s = []
@@ -1096,6 +1104,8 @@ def tile_extract(trnfile='/home/rink/tiles_l1b_train.h5', tstfile='/home/rink/ti
         icing_int = f['icing_intensity'][:]
 
         for i in range(num_obs):
+            if check_keep_out and not check_times(times[i]):
+                continue
             cld_msk = f[cld_mask_name][i, 12:28, 12:28]
             for ds_name in params:
                 dat = f[ds_name][i, 12:28, 12:28]
@@ -1133,6 +1143,8 @@ def tile_extract(trnfile='/home/rink/tiles_l1b_train.h5', tstfile='/home/rink/ti
         lats = f['latitude']
 
         for i in range(num_obs):
+            if check_keep_out and not check_times(times[i]):
+                continue
             cld_msk = f[cld_mask_name][i, 12:28, 12:28]
             for ds_name in params:
                 dat = f[ds_name][i, 12:28, 12:28]
-- 
GitLab