[update] raising PickingFailedException when CF cannot be calculated due to missing signal (too short waveform)

[update] raising PickingFailedException when CF cannot be calculated due to missing signal (too short waveform)
This commit is contained in:
2024-06-05 14:31:09 +02:00
parent 05642e775b
commit 93b7de3baa
3 changed files with 22 additions and 15 deletions
+5
View File
@@ -20,6 +20,8 @@ import numpy as np
from scipy import signal
from obspy.core import Stream
from pylot.core.pick.utils import PickingFailedException
class CharacteristicFunction(object):
"""
@@ -488,6 +490,9 @@ class ARHcf(CharacteristicFunction):
print('Calculating AR-prediction error from both horizontal traces ...')
xnp = self.getDataArray(self.getCut())
if len(xnp[0]) == 0:
raise PickingFailedException('calcCF: Found empty data trace for cut times. Return')
n0 = np.isnan(xnp[0].data)
if len(n0) > 1:
xnp[0].data[n0] = 0