From cc5cec3021c8caf5a54f549bd3c223f5431c8616 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Mon, 23 Aug 2021 11:46:10 -0500 Subject: [PATCH] snapshot... --- modules/icing/pirep_goes.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/icing/pirep_goes.py b/modules/icing/pirep_goes.py index fe0c5e92..60ab8d94 100644 --- a/modules/icing/pirep_goes.py +++ b/modules/icing/pirep_goes.py @@ -1497,18 +1497,22 @@ def spatial_filter(icing_dict): # dt_str_0: start datetime string in format YYYY-MM-DD_HH:MM # dt_str_1: end datetime string in format YYYY-MM-DD_HH:MM # return a flatten list of icing reports -def time_filter(dt_str_0, dt_str_1, icing_dct): - dto_0 = datetime.datetime.strptime(dt_str_0, '%Y-%m-%d_%H:%M').replace(tzinfo=timezone.utc) - ts_0 = dto_0.timestamp() +def time_filter(icing_dct, dt_str_0=None, dt_str_1=None): + ts_0 = 0 + if dt_str_0 is not None: + dto_0 = datetime.datetime.strptime(dt_str_0, '%Y-%m-%d_%H:%M').replace(tzinfo=timezone.utc) + ts_0 = dto_0.timestamp() - dto_1 = datetime.datetime.strptime(dt_str_1, '%Y-%m-%d_%H:%M').replace(tzinfo=timezone.utc) - ts_1 = dto_1.timestamp() + ts_1 = np.finfo(np.float64).max + if dt_str_1 is not None: + dto_1 = datetime.datetime.strptime(dt_str_1, '%Y-%m-%d_%H:%M').replace(tzinfo=timezone.utc) + ts_1 = dto_1.timestamp() keep_reports = [] keep_times = [] for ts in list(icing_dct.keys()): - if not (ts_0 <= ts < ts_1): + if ts_0 <= ts < ts_1: rpts = icing_dct[ts] for idx, tup in enumerate(rpts): keep_reports.append(tup) -- GitLab