Skip to content
Snippets Groups Projects
Commit 2f892d97 authored by tomrink's avatar tomrink
Browse files

snapshot...

parent fb8ff298
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment