[change] traces that could not be restituted are now removed from trace

This commit is contained in:
Sebastian Wehling-Benatelli 2016-09-27 15:13:51 +02:00
parent 28a5cedbc6
commit cf514ae024

View File

@ -214,10 +214,6 @@ def restitute_data(data, invtype, inobj, unit='VEL', force=False):
for tr in data:
seed_id = tr.get_id()
# check, whether this trace has already been corrected
# TODO read actual value of processing key in Trace's stats instead
# of just looking for thr key: if processing is setit doesn't
# necessarily mean that the trace has been corrected so far but only
# processed in some way, e.g. normalized
if 'processing' in tr.stats.keys() \
and np.all(['remove' in p for p in tr.stats.processing]) \
and not force:
@ -252,7 +248,7 @@ def restitute_data(data, invtype, inobj, unit='VEL', force=False):
finv = invlist[0]
inventory = read_inventory(finv, format='STATIONXML')
else:
restflag.append(False)
data.remove(tr)
continue
# apply restitution to data
try:
@ -268,7 +264,9 @@ def restitute_data(data, invtype, inobj, unit='VEL', force=False):
if msg0 not in e.message or msg1 not in e.message:
raise
else:
restflag.append(False)
# restitution done to copies of data thus deleting traces
# that failed should not be a problem
data.remove(tr)
continue
restflag.append(True)
# check if ALL traces could be restituted, take care of large datasets
@ -319,4 +317,4 @@ def get_prefilt(trace, tlow=(0.5, 0.9), thi=(5., 2.), verbosity=0):
if __name__ == "__main__":
import doctest
doctest.testmod()
doctest.testmod()