From a6634048da4bb8a82914e7d7d5048c988b815ffb Mon Sep 17 00:00:00 2001 From: rink <rink@ssec.wisc.edu> Date: Thu, 26 Aug 2021 15:45:02 -0500 Subject: [PATCH] fix fcst time offset in get_bounding_gfs_files --- modules/util/util.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/util/util.py b/modules/util/util.py index 72664421..ed605e94 100644 --- a/modules/util/util.py +++ b/modules/util/util.py @@ -185,6 +185,23 @@ def value_to_index(nda, value): return idx +def find_bin_index(nda, value): + idxs = np.arange(nda.shape[0]) + + above = nda >= value + if not above.any(): + return -1 + + below = nda < value + if not below.any(): + return -1 + + iL = idxs[above].max() + + return iL + + + # array solzen must be degrees, missing values must NaN. For small roughly 50x50km regions only def is_day(solzen, test_angle=80.0): solzen = solzen.flatten() -- GitLab