From 2a71d022ccfe5a968eac2dcd226ba3aa9db5969e Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Tue, 28 Dec 2021 10:31:17 -0600
Subject: [PATCH] minor

---
 modules/util/util.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/modules/util/util.py b/modules/util/util.py
index 423fc7c3..2ee0baef 100644
--- a/modules/util/util.py
+++ b/modules/util/util.py
@@ -142,6 +142,15 @@ def get_breaks(t, threshold):
     return idxs
 
 
+# return indexes of ts where value is within ts[i] - threshold < value < ts[i] + threshold
+def get_indexes_within_threshold(ts, value, threshold):
+    idx_s = []
+    for k, v in enumerate(ts):
+        if (ts[k] - threshold) < value < (ts[k] + threshold):
+            idx_s.append(k)
+    return idx_s
+
+
 def pressure_to_altitude(pres, temp, prof_pres, prof_temp, sfc_pres=None, sfc_temp=None, sfc_elev=0):
     if not np.all(np.diff(prof_pres) > 0):
         raise GenericException("target pressure profile must be monotonic increasing")
-- 
GitLab