Commit ea51903b authored by Jose Angel Lopez Comino's avatar Jose Angel Lopez Comino
Browse files

improved error message when downsampling fails

parent d9aa71ad
import sys
import logging
import numpy as num
from pyrocko.guts import Object, String, Float
from pyrocko import trace, autopick
from pyrocko import trace, autopick, util
from lassie import shifter, common
logger = logging.getLogger('lassie.ifc')
guts_prefix = 'lassie'
......@@ -46,7 +50,7 @@ class WavePacketIFC(IFC):
if not trs:
return []
deltat_cf = trs[0].deltat
deltat_cf = max(tr.deltat for tr in trs)
while deltat_cf * 2 < 0.25 / self.fmin:
deltat_cf *= 2
......@@ -63,7 +67,14 @@ class WavePacketIFC(IFC):
tr.set_ydata(num.maximum(tr.ydata, 0.0))
tr.shift(-(n/2.*tr.deltat))
tr.downsample_to(deltat_cf, snap=True, demean=False)
try:
tr.downsample_to(deltat_cf, snap=True, demean=False)
except util.UnavailableDecimation as e:
logger.fatal('%s, in_deltat = %g, out_deltat = %g' % (
e, tr.deltat, deltat_cf))
sys.exit(1)
trs_filt.append(tr)
trs_by_nsl = common.grouped_by(trs_filt, lambda tr: tr.nslc_id[:3])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment