restituteWFData: searches now for keyword processing to check, whether this trace has already been corrected or not.

This commit is contained in:
Ludger Küperkoch 2015-08-27 11:40:42 +02:00
parent 845fd6a7b3
commit 96395f6a1a

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import pdb
import os import os
import glob import glob
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
@ -151,8 +152,8 @@ class Data(object):
# remove underscores # remove underscores
if tr.stats.station[3] == '_': if tr.stats.station[3] == '_':
tr.stats.station = tr.stats.station[0:3] tr.stats.station = tr.stats.station[0:3]
dlp = '%s/*.dataless' % invdlpath dlp = '%s/*.dless' % invdlpath
invp = '%s/*.inv' % invdlpath invp = '%s/*.xml' % invdlpath
respp = '%s/*.resp' % invdlpath respp = '%s/*.resp' % invdlpath
dlfile = glob.glob(dlp) dlfile = glob.glob(dlp)
invfile = glob.glob(invp) invfile = glob.glob(invp)
@ -167,7 +168,9 @@ class Data(object):
parser = Parser('%s' % dlfile[j]) parser = Parser('%s' % dlfile[j])
for i in range(len(st)): for i in range(len(st)):
# check, whether this trace has already been corrected # check, whether this trace has already been corrected
if len(st[i].stats) < 13: try:
st[i].stats.processing
except:
try: try:
print "Correcting %s, %s for instrument response ..." \ print "Correcting %s, %s for instrument response ..." \
% (st[i].stats.station, st[i].stats.channel) % (st[i].stats.station, st[i].stats.channel)
@ -184,7 +187,6 @@ class Data(object):
print vmsg print vmsg
else: else:
print "Trace has already been corrected!" print "Trace has already been corrected!"
# check for inventory-xml file # check for inventory-xml file
if len(invfile) >= 1: if len(invfile) >= 1:
print "Found inventory-xml file(s)!" print "Found inventory-xml file(s)!"
@ -194,7 +196,9 @@ class Data(object):
inv = read_inventory(invfile[j], format="STATIONXML") inv = read_inventory(invfile[j], format="STATIONXML")
for i in range(len(st)): for i in range(len(st)):
# check, whether this trace has already been corrected # check, whether this trace has already been corrected
if len(st[i].stats) < 13: try:
st[i].stats.processing
except:
try: try:
print "Correcting %s, %s for instrument response ..." \ print "Correcting %s, %s for instrument response ..." \
% (st[i].stats.station, st[i].stats.channel) % (st[i].stats.station, st[i].stats.channel)
@ -209,6 +213,8 @@ class Data(object):
except ValueError, e: except ValueError, e:
vmsg = '{0}'.format(e) vmsg = '{0}'.format(e)
print vmsg print vmsg
else:
print "Trace has already been corrected!"
# check for RESP-file # check for RESP-file
if len(respfile) >= 1: if len(respfile) >= 1:
print "Found response file(s)!" print "Found response file(s)!"
@ -217,7 +223,9 @@ class Data(object):
print respfile[j] print respfile[j]
for i in range(len(st)): for i in range(len(st)):
# check, whether this trace has already been corrected # check, whether this trace has already been corrected
if len(st[i].stats) < 13: try:
st[i].stats.processing
except:
try: try:
print "Correcting %s, %s for instrument response ..." \ print "Correcting %s, %s for instrument response ..." \
% (st[i].stats.station, st[i].stats.channel) % (st[i].stats.station, st[i].stats.channel)
@ -233,6 +241,8 @@ class Data(object):
except ValueError, e: except ValueError, e:
vmsg = '{0}'.format(e) vmsg = '{0}'.format(e)
print vmsg print vmsg
else:
print "Trace has already been corrected!"
if len(respfile) < 1 and len(invfile) < 1 and len(dlfile) < 1: if len(respfile) < 1 and len(invfile) < 1 and len(dlfile) < 1:
print "No dataless-SEED file,inventory-xml file nor RESP-file found!" print "No dataless-SEED file,inventory-xml file nor RESP-file found!"