[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: for tr in data:
seed_id = tr.get_id() seed_id = tr.get_id()
# check, whether this trace has already been corrected # 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() \ if 'processing' in tr.stats.keys() \
and np.all(['remove' in p for p in tr.stats.processing]) \ and np.all(['remove' in p for p in tr.stats.processing]) \
and not force: and not force:
@ -252,7 +248,7 @@ def restitute_data(data, invtype, inobj, unit='VEL', force=False):
finv = invlist[0] finv = invlist[0]
inventory = read_inventory(finv, format='STATIONXML') inventory = read_inventory(finv, format='STATIONXML')
else: else:
restflag.append(False) data.remove(tr)
continue continue
# apply restitution to data # apply restitution to data
try: 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: if msg0 not in e.message or msg1 not in e.message:
raise raise
else: else:
restflag.append(False) # restitution done to copies of data thus deleting traces
# that failed should not be a problem
data.remove(tr)
continue continue
restflag.append(True) restflag.append(True)
# check if ALL traces could be restituted, take care of large datasets # check if ALL traces could be restituted, take care of large datasets