Bugfix in applyPicks: If there are automatic picks, OverwriteError is suppressed.

This commit is contained in:
Ludger Küperkoch 2016-10-28 11:04:56 +02:00
parent 61e4aa98c6
commit 236a1a43f8

View File

@ -12,7 +12,6 @@ from pylot.core.io.phases import readPILOTEvent, picks_from_picksdict, \
from pylot.core.util.errors import FormatError, OverwriteError from pylot.core.util.errors import FormatError, OverwriteError
from pylot.core.util.utils import fnConstructor, full_range from pylot.core.util.utils import fnConstructor, full_range
class Data(object): class Data(object):
""" """
Data container with attributes wfdata holding ~obspy.core.stream. Data container with attributes wfdata holding ~obspy.core.stream.
@ -298,10 +297,18 @@ class Data(object):
""" """
#firstonset = find_firstonset(picks) #firstonset = find_firstonset(picks)
if self.get_evt_data().picks: # check for automatic picks
raise OverwriteError('Actual picks would be overwritten!') for key in picks:
else: if picks[key]['P']['picker'] == 'autoPyLoT':
picks = picks_from_picksdict(picks) print("Warning: Existing picks will be overwritten!")
break
else:
if self.get_evt_data().picks:
raise OverwriteError('Existing picks would be overwritten!')
break
else:
picks = picks_from_picksdict(picks)
break
self.get_evt_data().picks = picks self.get_evt_data().picks = picks
# if 'smi:local' in self.getID() and firstonset: # if 'smi:local' in self.getID() and firstonset:
# fonset_str = firstonset.strftime('%Y_%m_%d_%H_%M_%S') # fonset_str = firstonset.strftime('%Y_%m_%d_%H_%M_%S')