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

snapshot...

parent 7888e154
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
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