diff --git a/modules/util/util.py b/modules/util/util.py index 3b841bc7341536329a2002cb1694970b3b70b26f..7ac24876ccbcbc514b585a097055a7ec93a0e869 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):