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'): ...@@ -63,16 +63,19 @@ def get_timestamp(dt_str, format_code='%Y-%m-%d_%H:%M'):
return ts 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) dt_obj, _ = get_time_tuple_utc(tstart)
str_start = dt_obj.strftime('%Y%m%d%H') str_start = dt_obj.strftime('%Y%m%d%H')
filename = w_o_ext+'_'+str_start
dt_obj, _ = get_time_tuple_utc(tend) if tend is not None:
str_end = dt_obj.strftime('%Y%m%d%H') dt_obj, _ = get_time_tuple_utc(tend)
str_end = dt_obj.strftime('%Y%m%d%H')
filename = os.path.split(pathname)[1] filename = filename+'_'+str_end
w_o_ext, ext = os.path.splitext(filename) filename = filename+ext
filename = w_o_ext+'_'+str_start+'_'+str_end+ext
path = os.path.split(pathname)[0] path = os.path.split(pathname)[0]
path = path+'/'+filename 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