From 255453475907c24a3a0c3edaf487e1fcfc672d78 Mon Sep 17 00:00:00 2001 From: marcel Date: Fri, 11 Aug 2017 16:07:23 +0200 Subject: [PATCH] [bugfix] a lot of different bugfixes --- pylot/core/pick/autopick.py | 20 ++++++++++++-------- pylot/core/pick/picker.py | 6 +++++- pylot/core/pick/utils.py | 4 ++++ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/pylot/core/pick/autopick.py b/pylot/core/pick/autopick.py index 25a781b2..bdf76c5b 100644 --- a/pylot/core/pick/autopick.py +++ b/pylot/core/pick/autopick.py @@ -68,9 +68,10 @@ def autopickevent(data, param, iplot=0, fig_dict=None, ncores=0, metadata=None, pool.close() for pick in result: - station = pick['station'] - pick.pop('station') - all_onsets[station] = pick + if pick: + station = pick['station'] + pick.pop('station') + all_onsets[station] = pick return all_onsets @@ -206,13 +207,14 @@ def autopickstation(wfstream, pickparam, verbose=False, if len(ndat) == 0: # check for other components ndat = wfstream.select(component="1") - - wfstart, wfend = full_range(wfstream) + if not zdat: + print('No z-component found for station {}. STOP'.format(wfstream[0].stats.station)) + return if algoP == 'HOS' or algoP == 'ARZ' and zdat is not None: msg = '##################################################\nautopickstation:' \ ' Working on P onset of station {station}\nFiltering vertical ' \ - 'trace ...\n{data}'.format(station=zdat[0].stats.station, + 'trace ...\n{data}'.format(station=wfstream[0].stats.station, data=str(zdat)) if verbose: print(msg) z_copy = zdat.copy() @@ -972,14 +974,16 @@ def autopickstation(wfstream, pickparam, verbose=False, else: # dummy values (start of seismic trace) in order to derive # theoretical onset times for iteratve picking - try: + if edat: lpickS = edat[0].stats.starttime + timeerrorsS[3] epickS = edat[0].stats.starttime - timeerrorsS[3] mpickS = edat[0].stats.starttime - except: + elif ndat: lpickS = ndat[0].stats.starttime + timeerrorsS[3] epickS = ndat[0].stats.starttime - timeerrorsS[3] mpickS = ndat[0].stats.starttime + else: + return # create dictionary # for P phase diff --git a/pylot/core/pick/picker.py b/pylot/core/pick/picker.py index f89d0036..4a7c0dc9 100644 --- a/pylot/core/pick/picker.py +++ b/pylot/core/pick/picker.py @@ -244,7 +244,11 @@ class AICPicker(AutoPicker): & (self.Tcf >= self.Pick)) # find maximum within slope determination window # 'cause slope should be calculated up to first local minimum only! - imax = np.argmax(self.Data[0].data[islope[0][0]:islope[0][len(islope[0])-1]]) + dataslope = self.Data[0].data[islope[0][0]:islope[0][len(islope[0]) - 1]] + if len(dataslope) < 1: + print('No data in slope window found!') + return + imax = np.argmax(dataslope) iislope = islope[0][0:imax+1] if len(iislope) <= 2: # calculate slope from initial onset to maximum of AIC function diff --git a/pylot/core/pick/utils.py b/pylot/core/pick/utils.py index 41a5509a..6a73849b 100644 --- a/pylot/core/pick/utils.py +++ b/pylot/core/pick/utils.py @@ -228,6 +228,10 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None): if len(zc1) == 3: break + if len(zc1) < 3: + print('fmpicker: Could not determine zero crossings!') + return + # if time difference betweeen 1st and 2cnd zero crossing # is too short, get time difference between 1st and 3rd # to derive maximum