From ec095c572d0d4082d38190fe6afc446319163199 Mon Sep 17 00:00:00 2001 From: marcel Date: Wed, 16 Aug 2017 13:23:40 +0200 Subject: [PATCH] [bugfix] if no cuttimes are set for h-comp skip S --- pylot/core/pick/autopick.py | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/pylot/core/pick/autopick.py b/pylot/core/pick/autopick.py index 0cf5e91c..85733f3e 100644 --- a/pylot/core/pick/autopick.py +++ b/pylot/core/pick/autopick.py @@ -229,7 +229,7 @@ def autopickstation(wfstream, pickparam, verbose=False, # for global seismology: use tau-p method for estimating travel times (needs source and station coords.) # if not given: sets Lc to infinity to use full stream - if use_taup: + if use_taup == True: Lc = np.inf print('autopickstation: use_taup flag active.') if not metadata[1]: @@ -271,7 +271,7 @@ def autopickstation(wfstream, pickparam, verbose=False, pstart = max(pstart, 0) pstop = min(pstop, len(zdat[0])*zdat[0].stats.delta) - if not use_taup or origin: + if not use_taup == True or origin: Lc = pstop - pstart Lwf = zdat[0].stats.endtime - zdat[0].stats.starttime @@ -526,16 +526,31 @@ def autopickstation(wfstream, pickparam, verbose=False, else: ndat = edat - if edat is not None and ndat is not None and len(edat) > 0 and len( - ndat) > 0 and Pweight < 4: + pickSonset = (edat is not None and ndat is not None and len(edat) > 0 and len( + ndat) > 0 and Pweight < 4) + + if pickSonset: + # determine time window for calculating CF after P onset + cuttimesh = [ + round(max([mpickP + sstart, 0])), # MP MP relative time axis + round(min([ + mpickP + sstop, + edat[0].stats.endtime-edat[0].stats.starttime, + ndat[0].stats.endtime-ndat[0].stats.starttime + ])) + ] + + if not cuttimesh[1] >= cuttimesh[0]: + print('Cut window for horizontal phases too small! Will not pick S onsets.') + pickSonset = False + + if pickSonset: msg = 'Go on picking S onset ...\n' \ '##################################################\n' \ 'Working on S onset of station {0}\nFiltering horizontal ' \ 'traces ...'.format(edat[0].stats.station) if verbose: print(msg) - # determine time window for calculating CF after P onset - cuttimesh = [round(max([mpickP + sstart, 0])), - round(min([mpickP + sstop, Lwf]))] + if algoS == 'ARH': # re-create stream object including both horizontal components