[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,6 +775,9 @@ 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
if self.pickparams['use_taup'] is True and self.origin is not None:
Lc = np.inf
try: try:
# modify pstart, pstop to be around theoretical onset if taupy should be used, else does nothing # modify pstart, pstop to be around theoretical onset if taupy should be used, else does nothing
self.modify_starttimes_taupy() self.modify_starttimes_taupy()
@ -782,6 +785,20 @@ class AutopickStation(object):
print(ae) print(ae)
except MissingTraceException as mte: except MissingTraceException as mte:
print(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