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