From 65a30838f09ad0fe80f81d4bbc978915f8401427 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Sat, 1 Jan 2022 13:42:26 -0600
Subject: [PATCH] snapshot...

---
 modules/util/util.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/util/util.py b/modules/util/util.py
index 3b841bc7..7ac24876 100644
--- a/modules/util/util.py
+++ b/modules/util/util.py
@@ -144,12 +144,15 @@ def get_breaks(t, threshold):
 
 # return indexes of ts where value is within ts[i] - threshold < value < ts[i] + threshold
 # eventually, if necessary, fully vectorize (numpy) this is possible
+# threshold units: seconds
 def get_indexes_within_threshold(ts, value, threshold):
     idx_s = []
+    t_s = []
     for k, v in enumerate(ts):
-        if (ts[k] - threshold) < value < (ts[k] + threshold):
+        if (ts[k] - threshold) <= value <= (ts[k] + threshold):
             idx_s.append(k)
-    return idx_s
+            t_s.append(v)
+    return idx_s, t_s
 
 
 def pressure_to_altitude(pres, temp, prof_pres, prof_temp, sfc_pres=None, sfc_temp=None, sfc_elev=0):
-- 
GitLab