Commit 071182c4 authored by doetschj's avatar doetschj
Browse files

timing in figures and in processing changed

parent 8900e046
......@@ -392,7 +392,8 @@ class Event(ObsPyEvent):
fparam = self.prparam['Folders']
# for name of each saved png, use start and end time of the 20ms snippet
t_start_plot = self.wf_stream.traces[0].stats["starttime"]
t_start_plotn = str(t_start_plot)[11:-1]
t_start_plot=str(t_start_plot)
t_start_plotn = t_start_plot[11:-1]
if self.classification=='noise':
t_title = 'Noise Visualisation at ' + t_start_plotn
else:
......@@ -479,8 +480,8 @@ class Event(ObsPyEvent):
if self.classification != 'noise':
if save_fig:
fig.savefig(fparam['plot_folder_'+self.classification] + "/event-" + "{:03d}".format(self.event_id) +
'_' + t_start_plotn.replace(':', '_') + ".png", dpi=100)
fig.savefig(fparam['plot_folder_'+self.classification] +
"/" + t_start_plot.replace(':', '').replace('.', '_').replace('T', '_').replace('-', '')[:-3] +"_" + "{:03d}".format(self.event_id) + ".png", dpi=100)
self.logger.info('Event ' + str(self.event_id) + ': Plotted, Figure saved.')
else:
self.logger.info('Event ' + str(self.event_id) + ': Plotted, Figure not saved.')
......
......@@ -60,14 +60,19 @@ def processing(param):
# load list of ASDF snippets in folder
sta_overlap = Stream()
# print(int(str(tparam['Time'])[6:8]))
# if tparam['processing time'] == True:
new_files = sorted([f for f in os.listdir(asdf_folder) if f.endswith('.h5') and int(re.findall('\d+', f)[3])>= tparam['Hr']]) # generates a list of the .asdf files in asdf_folder
if len(new_files):
if int(re.findall('\d+', new_files[0])[3]) > tparam['Hr']:
new_files = new_files
else:
new_files = sorted([f for f in new_files if int(re.findall('\d+', f)[4]) >= tparam['Min']])
new_files = sorted([f for f in os.listdir(asdf_folder) if f.endswith('.h5') and int(re.findall('\d+', f)[3])>= int(str(tparam['Time'])[8:10]) and int(re.findall('\d+', f)[4]) >= int(str(tparam['Time'])[10:12]) and int(re.findall('\d+', f)[2]) >= int(str(tparam['Time'])[6:8]) and int(re.findall('\d+', f)[1]) >= int(str(tparam['Time'])[4:6]) and int(re.findall('\d+', f)[0]) >= int(str(tparam['Time'])[:4])]) #20190523_050033 generates a list of the .asdf files in asdf_folder
# if len(new_files):
# if int(re.findall('\d+', new_files[0])[3]) > int(str(tparam['Time'])[8:10]):
# new_files = new_files
# else:
# new_files = sorted([f for f in new_files if int(re.findall('\d+', f)[4]) >= int(str(tparam['Time'])[10:12])])
print(new_files)
processed_files = []
......@@ -143,13 +148,14 @@ def processing(param):
processed_files.append(current_file)
else:
flist = sorted([f for f in os.listdir(asdf_folder) if f.endswith('.h5') and int(re.findall('\d+', f)[3])>= tparam['Hr'] and int(re.findall('\d+', f)[4])>=tparam['Min']])
if len(flist):
if int(re.findall('\d+', flist[0])[3]) > tparam['Hr']:
flist = flist
else:
flist = sorted([f for f in flist if int(re.findall('\d+', f)[4]) >= tparam['Min']])
flist = sorted([f for f in os.listdir(asdf_folder) if f.endswith('.h5') and int(re.findall('\d+', f)[3])>= int(str(tparam['Time'])[8:10]) and int(re.findall('\d+', f)[4]) >= int(str(tparam['Time'])[10:12]) and int(re.findall('\d+', f)[2]) >= int(str(tparam['Time'])[6:8]) and int(re.findall('\d+', f)[1]) >= int(str(tparam['Time'])[4:6]) and int(re.findall('\d+', f)[0]) >= int(str(tparam['Time'])[:4])])
# if len(flist):
# if int(re.findall('\d+', flist[0])[3]) > int(str(tparam['Time'])[8:10]):
# flist = flist
# else:
# flist = sorted([f for f in flist if int(re.findall('\d+', f)[4]) >= int(str(tparam['Time'])[10:12])])
new_files = [f for f in flist if f not in processed_files]
print(new_files)
if not len(new_files):
logger.info('Waiting for new files.')
time.sleep(1)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment