Commit f0e305e3 authored by Sebastian Heimann's avatar Sebastian Heimann
Browse files

add 'extend_incomplete' option to DatasetConfig

parent 2842b108
......@@ -902,6 +902,7 @@ class DatasetConfig(HasPaths):
station_corrections_path = Path.T(optional=True)
apply_correction_factors = Bool.T(default=True)
apply_correction_delays = Bool.T(default=True)
extend_incomplete = Bool.T(default=False)
picks_paths = List.T(Path.T())
blacklist_paths = List.T(Path.T())
blacklist = List.T(
......@@ -970,6 +971,7 @@ class DatasetConfig(HasPaths):
ds.apply_correction_factors = self.apply_correction_factors
ds.apply_correction_delays = self.apply_correction_delays
ds.extend_incomplete = self.extend_incomplete
for picks_path in self.picks_paths:
ds.add_picks(
......
......@@ -75,6 +75,7 @@ class Dataset(object):
self.pick_markers = []
self.apply_correction_delays = True
self.apply_correction_factors = True
self.extend_incomplete = False
self.clip_handling = 'by_nsl'
self.synthetic_test = None
self._picks = None
......@@ -365,7 +366,8 @@ class Dataset(object):
tmax,
tpad=0.,
toffset_noise_extract=0.,
want_incomplete=False):
want_incomplete=False,
extend_incomplete=False):
net, sta, loc, cha = self.get_nslc(obj)
......@@ -392,12 +394,17 @@ class Dataset(object):
tmax=tmax+toffset_noise_extract,
tpad=tpad,
trace_selector=lambda tr: tr.nslc_id == (net, sta, loc, cha),
want_incomplete=want_incomplete)
want_incomplete=want_incomplete or extend_incomplete)
if toffset_noise_extract != 0.0:
for tr in trs:
tr.shift(-toffset_noise_extract)
if extend_incomplete and len(trs) == 1:
trs[0].extend(
tmin + toffset_noise_extract - tpad,
tmax + toffset_noise_extract + tpad)
if not want_incomplete and len(trs) != 1:
raise NotFound(
'waveform missing or incomplete',
......@@ -414,14 +421,16 @@ class Dataset(object):
tmin=None, tmax=None, tpad=0.,
tfade=0., freqlimits=None, deltat=None,
toffset_noise_extract=0.,
want_incomplete=False):
want_incomplete=False,
extend_incomplete=False):
assert quantity == 'displacement' # others not yet implemented
trs_raw = self.get_waveform_raw(
obj, tmin=tmin, tmax=tmax, tpad=tpad+tfade,
toffset_noise_extract=toffset_noise_extract,
want_incomplete=want_incomplete)
want_incomplete=want_incomplete,
extend_incomplete=extend_incomplete)
trs_restituted = []
for tr in trs_raw:
......@@ -574,7 +583,8 @@ class Dataset(object):
tfade=tfade,
freqlimits=freqlimits,
deltat=deltat,
want_incomplete=debug)
want_incomplete=debug,
extend_incomplete=self.extend_incomplete)
trs_restituted_group.extend(trs_restituted_this)
trs_raw_group.extend(trs_raw_this)
......
Supports Markdown
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