[bugfix] a lot of different bugfixes

This commit is contained in:
Marcel Paffrath 2017-08-11 16:07:23 +02:00
parent 039f98a811
commit 2554534759
3 changed files with 21 additions and 9 deletions

View File

@ -68,9 +68,10 @@ def autopickevent(data, param, iplot=0, fig_dict=None, ncores=0, metadata=None,
pool.close() pool.close()
for pick in result: for pick in result:
station = pick['station'] if pick:
pick.pop('station') station = pick['station']
all_onsets[station] = pick pick.pop('station')
all_onsets[station] = pick
return all_onsets return all_onsets
@ -206,13 +207,14 @@ def autopickstation(wfstream, pickparam, verbose=False,
if len(ndat) == 0: # check for other components if len(ndat) == 0: # check for other components
ndat = wfstream.select(component="1") ndat = wfstream.select(component="1")
if not zdat:
wfstart, wfend = full_range(wfstream) 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: if algoP == 'HOS' or algoP == 'ARZ' and zdat is not None:
msg = '##################################################\nautopickstation:' \ msg = '##################################################\nautopickstation:' \
' Working on P onset of station {station}\nFiltering vertical ' \ ' 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)) data=str(zdat))
if verbose: print(msg) if verbose: print(msg)
z_copy = zdat.copy() z_copy = zdat.copy()
@ -972,14 +974,16 @@ def autopickstation(wfstream, pickparam, verbose=False,
else: else:
# dummy values (start of seismic trace) in order to derive # dummy values (start of seismic trace) in order to derive
# theoretical onset times for iteratve picking # theoretical onset times for iteratve picking
try: if edat:
lpickS = edat[0].stats.starttime + timeerrorsS[3] lpickS = edat[0].stats.starttime + timeerrorsS[3]
epickS = edat[0].stats.starttime - timeerrorsS[3] epickS = edat[0].stats.starttime - timeerrorsS[3]
mpickS = edat[0].stats.starttime mpickS = edat[0].stats.starttime
except: elif ndat:
lpickS = ndat[0].stats.starttime + timeerrorsS[3] lpickS = ndat[0].stats.starttime + timeerrorsS[3]
epickS = ndat[0].stats.starttime - timeerrorsS[3] epickS = ndat[0].stats.starttime - timeerrorsS[3]
mpickS = ndat[0].stats.starttime mpickS = ndat[0].stats.starttime
else:
return
# create dictionary # create dictionary
# for P phase # for P phase

View File

@ -244,7 +244,11 @@ class AICPicker(AutoPicker):
& (self.Tcf >= self.Pick)) & (self.Tcf >= self.Pick))
# find maximum within slope determination window # find maximum within slope determination window
# 'cause slope should be calculated up to first local minimum only! # '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] iislope = islope[0][0:imax+1]
if len(iislope) <= 2: if len(iislope) <= 2:
# calculate slope from initial onset to maximum of AIC function # calculate slope from initial onset to maximum of AIC function

View File

@ -228,6 +228,10 @@ def fmpicker(Xraw, Xfilt, pickwin, Pick, iplot=0, fig=None):
if len(zc1) == 3: if len(zc1) == 3:
break break
if len(zc1) < 3:
print('fmpicker: Could not determine zero crossings!')
return
# if time difference betweeen 1st and 2cnd zero crossing # if time difference betweeen 1st and 2cnd zero crossing
# is too short, get time difference between 1st and 3rd # is too short, get time difference between 1st and 3rd
# to derive maximum # to derive maximum