Introduced option for running autoPyLoT without location routine, if parameter nllocbin in autoPyLoT.in is not set.

This commit is contained in:
Ludger Küperkoch 2015-10-28 09:13:13 +01:00
parent 43d243e0a1
commit fc319f7162

View File

@ -6,8 +6,7 @@ import os
import argparse
import glob
import subprocess
import matplotlib.pyplot as plt
import pdb
from obspy.core import read
from pylot.core.read.data import Data
from pylot.core.read.inputs import AutoPickParameter
@ -20,7 +19,7 @@ __version__ = _getVersionString()
def autoPyLoT(inputfile):
'''
"""
Determine phase onsets automatically utilizing the automatic picking
algorithms by Kueperkoch et al. 2010/2012.
@ -32,7 +31,7 @@ def autoPyLoT(inputfile):
.. rubric:: Example
'''
"""
print '************************************'
print '*********autoPyLoT starting*********'
print 'The Python picking and Location Tool'
@ -57,9 +56,9 @@ def autoPyLoT(inputfile):
if parameter.hasParam('datastructure'):
datastructure = DATASTRUCTURE[parameter.getParam('datastructure')]()
dsfields = {'root':parameter.getParam('rootpath'),
'dpath':parameter.getParam('datapath'),
'dbase':parameter.getParam('database')}
dsfields = {'root' :parameter.getParam('rootpath'),
'dpath' :parameter.getParam('datapath'),
'dbase' :parameter.getParam('database')}
exf = ['root', 'dpath', 'dbase']
@ -70,9 +69,9 @@ def autoPyLoT(inputfile):
datastructure.modifyFields(**dsfields)
datastructure.setExpandFields(exf)
# get path to inventory or dataless-seed file with station meta data
invdir = parameter.getParam('invdir')
# check if default location routine NLLoc is available
if parameter.hasParam('nllocbin'):
locflag = 1
# get NLLoc-root path
nllocroot = parameter.getParam('nllocroot')
# get path to NLLoc executable
@ -89,6 +88,9 @@ def autoPyLoT(inputfile):
ttpatter = '%s/time/%s' % (nllocroot, ttpat)
# patter of NLLoc-output file
nllocoutpatter = parameter.getParam('outpatter')
else:
locflag = 0
print ("!!No location routine available, autoPyLoT just picks the events without locating them!!")
# multiple event processing
@ -97,7 +99,7 @@ def autoPyLoT(inputfile):
if not parameter.hasParam('eventID'):
for event in [events for events in glob.glob(os.path.join(datapath, '*')) if os.path.isdir(events)]:
data.setWFData(glob.glob(os.path.join(datapath, event, '*')))
print 'Working on event %s' %event
print 'Working on event %s' % event
print data
wfdat = data.getWFData() # all available streams
@ -105,10 +107,12 @@ def autoPyLoT(inputfile):
# !automated picking starts here!
picks = autopickevent(wfdat, parameter)
##########################################################
# locating
if locflag == 1:
# write phases to NLLoc-phase file
writephases(picks, 'NLLoc', phasefile)
##########################################################
# For locating the events we have to modify the NLLoc-control file!
# create comment line for NLLoc-control file
# NLLoc-output file
@ -145,10 +149,12 @@ def autoPyLoT(inputfile):
# !automated picking starts here!
picks = autopickevent(wfdat, parameter)
##########################################################
# locating
if locflag == 1:
# write phases to NLLoc-phase file
writephases(picks, 'NLLoc', phasefile)
##########################################################
# For locating the event we have to modify the NLLoc-control file!
# create comment line for NLLoc-control file NLLoc-output file
nllocout = '%s/loc/%s_%s' % (nllocroot, parameter.getParam('eventID'), nllocoutpatter)