From 2f892d970a6cb05597e3667c948c308a96d15e04 Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Mon, 23 Aug 2021 10:41:04 -0500 Subject: [PATCH] snapshot... --- modules/util/util.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/util/util.py b/modules/util/util.py index 2eecfd13..65a2df0b 100644 --- a/modules/util/util.py +++ b/modules/util/util.py @@ -259,9 +259,11 @@ def get_grid_values_all(h5f, grid_name, scale_factor_name='scale_factor', add_of # dt_str_0: start datetime string in format YYYY-MM-DD_HH:MM +# dt_str_1: stop datetime string, if not None num_steps is computed # num_steps with increment of days, hours, minutes or seconds +# dt_str_1 and num_steps cannot both be None # return num_steps+1 lists of datetime strings and timestamps for the times eries -def make_times(dt_str_0, num_steps, days=None, hours=None, minutes=None, seconds=None): +def make_times(dt_str_0, dt_str_1=None, num_steps=None, days=None, hours=None, minutes=None, seconds=None): if days is not None: inc = 86400*days elif hours is not None: @@ -275,6 +277,10 @@ def make_times(dt_str_0, num_steps, days=None, hours=None, minutes=None, seconds ts_s = [] dto_0 = datetime.datetime.strptime(dt_str_0, '%Y-%m-%d_%H:%M').replace(tzinfo=timezone.utc) ts_0 = dto_0.timestamp() + 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() + num_steps = int((ts_1 - ts_0)/inc) dt_obj_s.append(dto_0) ts_s.append(ts_0) -- GitLab