From 236a1a43f8bf0bcc0842ad3553e87cd92cace99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Fri, 28 Oct 2016 11:04:56 +0200 Subject: [PATCH] Bugfix in applyPicks: If there are automatic picks, OverwriteError is suppressed. --- pylot/core/io/data.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/pylot/core/io/data.py b/pylot/core/io/data.py index c3ca8b85..b4a56416 100644 --- a/pylot/core/io/data.py +++ b/pylot/core/io/data.py @@ -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.utils import fnConstructor, full_range - class Data(object): """ Data container with attributes wfdata holding ~obspy.core.stream. @@ -298,10 +297,18 @@ class Data(object): """ #firstonset = find_firstonset(picks) - if self.get_evt_data().picks: - raise OverwriteError('Actual picks would be overwritten!') - else: - picks = picks_from_picksdict(picks) + # check for automatic picks + for key in picks: + if picks[key]['P']['picker'] == 'autoPyLoT': + 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 # if 'smi:local' in self.getID() and firstonset: # fonset_str = firstonset.strftime('%Y_%m_%d_%H_%M_%S')