[bugfix] added check for length of data array, code was lost on refactoring

This commit is contained in:
Marcel Paffrath 2019-06-18 13:47:29 +02:00
parent 61b514fae1
commit 06235cc092

View File

@ -775,13 +775,30 @@ class AutopickStation(object):
tr_filt, z_copy = self.prepare_wfstream(self.zstream, self.pickparams["bpz1"][0], self.pickparams["bpz1"][1]) tr_filt, z_copy = self.prepare_wfstream(self.zstream, self.pickparams["bpz1"][0], self.pickparams["bpz1"][1])
# save filtered trace in instance for later plotting # save filtered trace in instance for later plotting
self.tr_filt_z_bpz2 = tr_filt self.tr_filt_z_bpz2 = tr_filt
try:
# modify pstart, pstop to be around theoretical onset if taupy should be used, else does nothing if self.pickparams['use_taup'] is True and self.origin is not None:
self.modify_starttimes_taupy() Lc = np.inf
except AttributeError as ae: try:
print(ae) # modify pstart, pstop to be around theoretical onset if taupy should be used, else does nothing
except MissingTraceException as mte: self.modify_starttimes_taupy()
print(mte) except AttributeError as ae:
print(ae)
except MissingTraceException as mte:
print(mte)
else:
Lc = self.pickparams['pstop'] - self.pickparams['pstart']
Lwf = self.ztrace.stats.endtime - self.ztrace.stats.starttime
if Lwf < 0:
raise PickingFailedException('autopickstation: empty trace! Return!')
Ldiff = Lwf - abs(Lc)
if Ldiff < 0 or self.pickparams['pstop'] <= self.pickparams['pstart']:
msg = 'autopickstation: Cutting times are too large for actual waveform!\nUsing entire waveform instead!'
self.vprint(msg)
self.pickparams['pstart'] = 0
self.pickparams['pstop'] = len(self.ztrace.data) * self.ztrace.stats.delta
cuttimes = self._calculate_cuttimes('P', 1) cuttimes = self._calculate_cuttimes('P', 1)
# calculate first CF # calculate first CF