From 0f4d13b8a5a2b64afd20570a4a5674d78df2eae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Thu, 27 Aug 2015 09:46:35 +0200 Subject: [PATCH 1/7] Changed permissions. --- autoPyLoT.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 autoPyLoT.py diff --git a/autoPyLoT.py b/autoPyLoT.py old mode 100644 new mode 100755 From 4bfe4ce0474f4097e7a637eaa152f1b8c72ea6a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Thu, 27 Aug 2015 09:53:05 +0200 Subject: [PATCH 2/7] Marginal changes. --- pylot/core/pick/autopick.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pylot/core/pick/autopick.py b/pylot/core/pick/autopick.py index 6c235f18..3c074a7d 100755 --- a/pylot/core/pick/autopick.py +++ b/pylot/core/pick/autopick.py @@ -163,7 +163,7 @@ def autopickstation(wfstream, pickparam): if Ldiff < 0: print 'autopickstation: Cutting times are too large for actual ' \ 'waveform!' - print 'Use entire waveform instead!' + print 'Using entire waveform instead!' pstart = 0 pstop = len(zdat[0].data) * zdat[0].stats.delta cuttimes = [pstart, pstop] @@ -200,7 +200,7 @@ def autopickstation(wfstream, pickparam): # both horizontal traces needed if len(ndat) == 0 or len(edat) == 0: print 'One or more horizontal components missing!' - print 'Skip control function checkZ4S.' + print 'Skipping control function checkZ4S.' else: # filter and taper horizontal traces trH1_filt = edat.copy() @@ -297,14 +297,14 @@ def autopickstation(wfstream, pickparam): Sflag = 1 else: - print 'Bad initial (AIC) P-pick, skip this onset!' + print 'Bad initial (AIC) P-pick, skipping this onset!' print 'AIC-SNR=', aicpick.getSNR(), 'AIC-Slope=', aicpick.getSlope(), 'counts/s' print '(min. AIC-SNR=', minAICPSNR, ', min. AIC-Slope=', minAICPslope, 'counts/s)' Sflag = 0 else: - print 'autopickstation: No vertical component data availabler!, ' \ - 'Skip station!' + print 'autopickstation: No vertical component data available!, ' \ + 'Skipping station!' if edat is not None and ndat is not None and len(edat) > 0 and len( ndat) > 0 and Pweight < 4: @@ -503,7 +503,7 @@ def autopickstation(wfstream, pickparam): Sweight, SNRS, SNRSdB) else: - print 'Bad initial (AIC) S-pick, skip this onset!' + print 'Bad initial (AIC) S-pick, skipping this onset!' print 'AIC-SNR=', aicarhpick.getSNR(), \ 'AIC-Slope=', aicarhpick.getSlope(), 'counts/s' print '(min. AIC-SNR=', minAICSSNR, ', min. AIC-Slope=', \ From 834e836a3d7a55285d88ff2bf2cb8e00bc7d1a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Thu, 27 Aug 2015 11:01:59 +0200 Subject: [PATCH 3/7] Removed parameter prefilt, no more necessary. --- autoPyLoT_local.in | 1 - 1 file changed, 1 deletion(-) diff --git a/autoPyLoT_local.in b/autoPyLoT_local.in index dbe9bb77..18849c2e 100644 --- a/autoPyLoT_local.in +++ b/autoPyLoT_local.in @@ -10,7 +10,6 @@ EVENT_DATA/LOCAL #datapath# %data path 2013.02_Insheim #database# %name of data base e0019.048.13 #eventID# %event ID for single event processing /DATA/Insheim/STAT_INFO #invdir# %full path to inventory or dataless-seed file -0.5 0.9 190.0 195.0 #prefilt# %corner frequencies for pre-filtering traces before restitution PILOT #datastructure# %choose data structure 0 #iplot# %flag for plotting: 0 none, 1, partly, >1 everything AUTOPHASES_AIC_HOS4_ARH #phasefile# %name of autoPILOT output phase file From 845fd6a7b3c0a0c74461b8ef7939fcbf1735b028 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Thu, 27 Aug 2015 11:04:46 +0200 Subject: [PATCH 4/7] restituteWFData: able to handle several dataless-, inventory- or resp-files, calculates prefiltering from sampling rate of trace. Processing with inventory- or resp-file has yet not been checked! --- pylot/core/read/data.py | 104 +++++++++++++++++++++++++++++----------- 1 file changed, 77 insertions(+), 27 deletions(-) diff --git a/pylot/core/read/data.py b/pylot/core/read/data.py index 7723988a..78dd1c7c 100644 --- a/pylot/core/read/data.py +++ b/pylot/core/read/data.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import pdb import os import glob import matplotlib.pyplot as plt @@ -146,10 +145,11 @@ class Data(object): self.wfdata = self.getOriginalWFData().copy() self.dirty = False - def restituteWFData(self, invdlpath, prefilt): + def restituteWFData(self, invdlpath): st = self.getWFData() for tr in st: - if tr.stats.station[3] == '_': # this is for some ugly station naming + # remove underscores + if tr.stats.station[3] == '_': tr.stats.station = tr.stats.station[0:3] dlp = '%s/*.dataless' % invdlpath invp = '%s/*.inv' % invdlpath @@ -158,38 +158,88 @@ class Data(object): invfile = glob.glob(invp) respfile = glob.glob(respp) + # check for dataless-SEED file if len(dlfile) >= 1: - print "Found dataless-SEED file!" + print "Found dataless-SEED file(s)!" print "Reading meta data information ..." - print dlfile[0] - parser = Parser('%s' % dlfile[0]) + for j in range(len(dlfile)): + print dlfile[j] + parser = Parser('%s' % dlfile[j]) + for i in range(len(st)): + # check, whether this trace has already been corrected + if len(st[i].stats) < 13: + try: + print "Correcting %s, %s for instrument response ..." \ + % (st[i].stats.station, st[i].stats.channel) + # get corner frequencies for pre-filtering + fny = st[i].stats.sampling_rate / 2 + fc21 = fny - (fny * 0.05) + fc22 = fny - (fny * 0.02) + prefilt = [0.5, 0.9, fc21, fc22] + # instrument correction + st[i].simulate(pre_filt=prefilt, seedresp={'filename': parser, \ + 'date': st[i].stats.starttime, 'units': "VEL"}) + except ValueError, e: + vmsg = '{0}'.format(e) + print vmsg + else: + print "Trace has already been corrected!" - try: - print "Correcting for instrument response ..." - st.simulate(pre_filt=prefilt, seedresp={'filename': parser, \ - 'date': st[0].stats.starttime, 'units': "VEL"}) - except ValueError, e: - vmsg = '{0}'.format(e) - print vmsg - - elif len(invfile) >= 1: - print "Found inventory-xml file!" + # check for inventory-xml file + if len(invfile) >= 1: + print "Found inventory-xml file(s)!" print "Reading meta data information ..." - inv = read_inventory(invfile, format="STATIONXML") - print "Applying instrument correction ..." - st.attach_response(inv) - st.remove_response(output='VEL', pre_filt=prefilt) - elif len(respfile) >= 1: - print "Found response file!" - print respfile - seedresp={'filename': respfile[0], 'date': st[0].stats.starttime, \ - 'units': "VEL"} - st.simulate(paz_remove=None, pre_filt=prefilt, seedresp=seedresp) - else: + for j in range(len(invfile)): + print invfile[j] + inv = read_inventory(invfile[j], format="STATIONXML") + for i in range(len(st)): + # check, whether this trace has already been corrected + if len(st[i].stats) < 13: + try: + print "Correcting %s, %s for instrument response ..." \ + % (st[i].stats.station, st[i].stats.channel) + # get corner frequencies for pre-filtering + fny = st[i].stats.sampling_rate / 2 + fc21 = fny - (fny * 0.05) + fc22 = fny - (fny * 0.02) + prefilt = [0.5, 0.9, fc21, fc22] + # instrument correction + st[i].attach_response(inv) + st[i].remove_response(output='VEL', pre_filt=prefilt) + except ValueError, e: + vmsg = '{0}'.format(e) + print vmsg + # check for RESP-file + if len(respfile) >= 1: + print "Found response file(s)!" + print "Reading meta data information ..." + for j in range(len(respfile)): + print respfile[j] + for i in range(len(st)): + # check, whether this trace has already been corrected + if len(st[i].stats) < 13: + try: + print "Correcting %s, %s for instrument response ..." \ + % (st[i].stats.station, st[i].stats.channel) + # get corner frequencies for pre-filtering + fny = st[i].stats.sampling_rate / 2 + fc21 = fny - (fny * 0.05) + fc22 = fny - (fny * 0.02) + prefilt = [0.5, 0.9, fc21, fc22] + # instrument correction + seedresp={'filename': respfile[0], 'date': st[0].stats.starttime, \ + 'units': "VEL"} + st[i].simulate(paz_remove=None, pre_filt=prefilt, seedresp=seedresp) + except ValueError, e: + vmsg = '{0}'.format(e) + print vmsg + + 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 "Go on processing data without source parameter determination!" return st + def getEvtData(self): return self.evtdata From 96395f6a1abdf295113b1f494d1982e53e2ebb54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Thu, 27 Aug 2015 11:40:42 +0200 Subject: [PATCH 5/7] restituteWFData: searches now for keyword processing to check, whether this trace has already been corrected or not. --- pylot/core/read/data.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/pylot/core/read/data.py b/pylot/core/read/data.py index 78dd1c7c..47a0fb1a 100644 --- a/pylot/core/read/data.py +++ b/pylot/core/read/data.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +import pdb import os import glob import matplotlib.pyplot as plt @@ -151,8 +152,8 @@ class Data(object): # remove underscores if tr.stats.station[3] == '_': tr.stats.station = tr.stats.station[0:3] - dlp = '%s/*.dataless' % invdlpath - invp = '%s/*.inv' % invdlpath + dlp = '%s/*.dless' % invdlpath + invp = '%s/*.xml' % invdlpath respp = '%s/*.resp' % invdlpath dlfile = glob.glob(dlp) invfile = glob.glob(invp) @@ -167,7 +168,9 @@ class Data(object): parser = Parser('%s' % dlfile[j]) for i in range(len(st)): # check, whether this trace has already been corrected - if len(st[i].stats) < 13: + try: + st[i].stats.processing + except: try: print "Correcting %s, %s for instrument response ..." \ % (st[i].stats.station, st[i].stats.channel) @@ -184,7 +187,6 @@ class Data(object): print vmsg else: print "Trace has already been corrected!" - # check for inventory-xml file if len(invfile) >= 1: print "Found inventory-xml file(s)!" @@ -194,7 +196,9 @@ class Data(object): inv = read_inventory(invfile[j], format="STATIONXML") for i in range(len(st)): # check, whether this trace has already been corrected - if len(st[i].stats) < 13: + try: + st[i].stats.processing + except: try: print "Correcting %s, %s for instrument response ..." \ % (st[i].stats.station, st[i].stats.channel) @@ -209,6 +213,8 @@ class Data(object): except ValueError, e: vmsg = '{0}'.format(e) print vmsg + else: + print "Trace has already been corrected!" # check for RESP-file if len(respfile) >= 1: print "Found response file(s)!" @@ -217,7 +223,9 @@ class Data(object): print respfile[j] for i in range(len(st)): # check, whether this trace has already been corrected - if len(st[i].stats) < 13: + try: + st[i].stats.processing + except: try: print "Correcting %s, %s for instrument response ..." \ % (st[i].stats.station, st[i].stats.channel) @@ -233,6 +241,8 @@ class Data(object): except ValueError, e: vmsg = '{0}'.format(e) print vmsg + else: + print "Trace has already been corrected!" if len(respfile) < 1 and len(invfile) < 1 and len(dlfile) < 1: print "No dataless-SEED file,inventory-xml file nor RESP-file found!" From 3e164fd0c6e73ea264cfcaa45885bbd96ff14542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Thu, 27 Aug 2015 14:24:52 +0200 Subject: [PATCH 6/7] restituteWFData: More output for user. --- pylot/core/read/data.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pylot/core/read/data.py b/pylot/core/read/data.py index 47a0fb1a..18e2cabd 100644 --- a/pylot/core/read/data.py +++ b/pylot/core/read/data.py @@ -146,8 +146,12 @@ class Data(object): self.wfdata = self.getOriginalWFData().copy() self.dirty = False - def restituteWFData(self, invdlpath): - st = self.getWFData() + def restituteWFData(self, invdlpath, streams=None): + if streams == None: + st = self.getWFData() + else: + st = streams + for tr in st: # remove underscores if tr.stats.station[3] == '_': @@ -164,7 +168,7 @@ class Data(object): print "Found dataless-SEED file(s)!" print "Reading meta data information ..." for j in range(len(dlfile)): - print dlfile[j] + print "Found dataless-SEED file %s" % dlfile[j] parser = Parser('%s' % dlfile[j]) for i in range(len(st)): # check, whether this trace has already been corrected @@ -192,7 +196,7 @@ class Data(object): print "Found inventory-xml file(s)!" print "Reading meta data information ..." for j in range(len(invfile)): - print invfile[j] + print "Found inventory-xml file %s" % invfile[j] inv = read_inventory(invfile[j], format="STATIONXML") for i in range(len(st)): # check, whether this trace has already been corrected @@ -220,7 +224,7 @@ class Data(object): print "Found response file(s)!" print "Reading meta data information ..." for j in range(len(respfile)): - print respfile[j] + print "Found RESP-file %s" % respfile[j] for i in range(len(st)): # check, whether this trace has already been corrected try: From ee777b4beb114b6b1f4450105100976598ee525f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludger=20K=C3=BCperkoch?= Date: Thu, 27 Aug 2015 14:26:15 +0200 Subject: [PATCH 7/7] Removed import pdb. --- pylot/core/read/data.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pylot/core/read/data.py b/pylot/core/read/data.py index 18e2cabd..5af2473a 100644 --- a/pylot/core/read/data.py +++ b/pylot/core/read/data.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import pdb import os import glob import matplotlib.pyplot as plt