From 99acc2382c9f98ec11ad505c1a6d130870a42c69 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Sat, 28 Aug 2021 10:34:22 -0500
Subject: [PATCH] snapshot...

---
 modules/util/util.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/modules/util/util.py b/modules/util/util.py
index ffa03291..8a9ce465 100644
--- a/modules/util/util.py
+++ b/modules/util/util.py
@@ -276,10 +276,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
+# format_code: default '%Y-%m-%d_%H:%M'
 # 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 (edges of a numpy histogram)
-def make_times(dt_str_0, dt_str_1=None, num_steps=None, days=None, hours=None, minutes=None, seconds=None):
+def make_times(dt_str_0, dt_str_1=None, format_code='%Y-%m-%d_%H:%M', num_steps=None, days=None, hours=None, minutes=None, seconds=None):
     if days is not None:
         inc = 86400*days
     elif hours is not None:
@@ -291,11 +292,11 @@ def make_times(dt_str_0, dt_str_1=None, num_steps=None, days=None, hours=None, m
 
     dt_obj_s = []
     ts_s = []
-    dto_0 = datetime.datetime.strptime(dt_str_0, '%Y-%m-%d_%H:%M').replace(tzinfo=timezone.utc)
+    dto_0 = datetime.datetime.strptime(dt_str_0, format_code).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)
+        dto_1 = datetime.datetime.strptime(dt_str_1, format_code).replace(tzinfo=timezone.utc)
         ts_1 = dto_1.timestamp()
         num_steps = int((ts_1 - ts_0)/inc)
 
-- 
GitLab