Capture possible error occuring due to to incomplete dictonaries.

This commit is contained in:
Ludger Küperkoch 2020-07-30 15:21:26 +02:00
parent da360990f6
commit e4cfebe989
2 changed files with 6 additions and 4 deletions

View File

@ -886,7 +886,6 @@ def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
try:
eventsource = eventinfo.origins[0]
except:
print("No source origin given! Locate event first!")
print("No source origin calculated yet, thus no cnv-file creation possible!")
return
eventsource = eventinfo.origins[0]

View File

@ -117,14 +117,17 @@ class Comparison(object):
pdf_a = self.get('auto').generate_pdf_data(type)
pdf_b = self.get('manu').generate_pdf_data(type)
for station, phases in pdf_a.items():
if station in pdf_b.keys():
compare_pdf = dict()
for phase in phases:
if phase in pdf_b[station].keys():
compare_pdf[phase] = phases[phase] - pdf_b[station][
phase]
try:
compare_pdf[phase] = phases[phase] - pdf_b[station][
phase]
except:
compare_pdf = None
if compare_pdf is not None:
compare_pdfs[station] = compare_pdf