From d365f5c9f880bb0338bcefc9fd3836062f30bb72 Mon Sep 17 00:00:00 2001
From: tomrink <rink@ssec.wisc.edu>
Date: Thu, 7 Apr 2022 11:23:58 -0500
Subject: [PATCH] snapshot...

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

diff --git a/modules/util/util.py b/modules/util/util.py
index 82469716..d14a0534 100644
--- a/modules/util/util.py
+++ b/modules/util/util.py
@@ -63,16 +63,19 @@ def get_timestamp(dt_str, format_code='%Y-%m-%d_%H:%M'):
     return ts
 
 
-def add_time_range_to_filename(pathname, tstart, tend):
+def add_time_range_to_filename(pathname, tstart, tend=None):
+    filename = os.path.split(pathname)[1]
+    w_o_ext, ext = os.path.splitext(filename)
+
     dt_obj, _ = get_time_tuple_utc(tstart)
     str_start = dt_obj.strftime('%Y%m%d%H')
+    filename = w_o_ext+'_'+str_start
 
-    dt_obj, _ = get_time_tuple_utc(tend)
-    str_end = dt_obj.strftime('%Y%m%d%H')
-
-    filename = os.path.split(pathname)[1]
-    w_o_ext, ext = os.path.splitext(filename)
-    filename = w_o_ext+'_'+str_start+'_'+str_end+ext
+    if tend is not None:
+        dt_obj, _ = get_time_tuple_utc(tend)
+        str_end = dt_obj.strftime('%Y%m%d%H')
+        filename = filename+'_'+str_end
+    filename = filename+ext
 
     path = os.path.split(pathname)[0]
     path = path+'/'+filename
-- 
GitLab