Implementation of module /loc/nll finished, running for single and multiple event processing.

This commit is contained in:
Ludger Küperkoch 2015-11-18 10:27:42 +01:00
parent c51ba1bd56
commit 8a84342883

View File

@ -78,12 +78,11 @@ def autoPyLoT(inputfile):
phasef = parameter.getParam('phasefile') phasef = parameter.getParam('phasefile')
phasefile = '%s/obs/%s' % (nllocroot, phasef) phasefile = '%s/obs/%s' % (nllocroot, phasef)
# get name of NLLoc-control file # get name of NLLoc-control file
locf = parameter.getParam('locfile') ctrf = parameter.getParam('ctrfile')
locfile = '%s/run/%s' % (nllocroot, locf) ctrfile = '%s/run/%s' % (nllocroot, ctrf)
# patter of NLLoc ttimes from location grid # pattern of NLLoc ttimes from location grid
ttpat = parameter.getParam('ttpatter') ttpat = parameter.getParam('ttpatter')
ttpatter = '%s/time/%s' % (nllocroot, ttpat) # pattern of NLLoc-output file
# patter of NLLoc-output file
nllocoutpatter = parameter.getParam('outpatter') nllocoutpatter = parameter.getParam('outpatter')
else: else:
locflag = 0 locflag = 0
@ -112,27 +111,15 @@ def autoPyLoT(inputfile):
picksExport(picks, 'NLLoc', phasefile) picksExport(picks, 'NLLoc', phasefile)
# For locating the event the NLLoc-control file has to be modified! # For locating the event the NLLoc-control file has to be modified!
# create comment line for NLLoc-control file
# NLLoc-output file
evID = event[string.rfind(event, "/") + 1 : len(events) - 1] evID = event[string.rfind(event, "/") + 1 : len(events) - 1]
nllocout = '%s/loc/%s_%s' % (nllocroot, evID, nllocoutpatter) nllocout = '%s_%s' % (evID, nllocoutpatter)
locfiles = 'LOCFILES %s NLLOC_OBS %s %s 0' % (phasefile, ttpatter, nllocout) # create comment line for NLLoc-control file
print ("Modifying NLLoc-control file %s ..." % locfile) modifyInputFile(ctrf, nllocroot, nllocout, phasef, ttpat)
# modification of NLLoc-control file
filedata = None
nllfile = open(locfile, 'r')
filedata = nllfile.read()
if filedata.find(locfiles) < 0:
# replace old command
filedata = filedata.replace('LOCFILES', locfiles)
nllfile = open(locfile, 'w')
nllfile.write(filedata)
nllfile.close()
# locate the event # locate the event
subprocess.call([nlloccall, locfile]) locate(nlloccall, ctrfile)
# !iterative picking if traces remained unpicked or with bad picks! # !iterative picking if traces remained unpicked or occupied with bad picks!
# get theoretical onset times for picks with weights >= 4 # get theoretical onset times for picks with weights >= 4
# in order to reprocess them using smaller time windows # in order to reprocess them using smaller time windows
########################################################## ##########################################################
@ -167,25 +154,14 @@ def autoPyLoT(inputfile):
picksExport(picks, 'NLLoc', phasefile) picksExport(picks, 'NLLoc', phasefile)
# For locating the event the NLLoc-control file has to be modified! # For locating the event the NLLoc-control file has to be modified!
# create comment line for NLLoc-control file NLLoc-output file nllocout = '%s_%s' % (parameter.getParam('eventID'), nllocoutpatter)
nllocout = '%s/loc/%s_%s' % (nllocroot, parameter.getParam('eventID'), nllocoutpatter) # create comment line for NLLoc-control file
locfiles = 'LOCFILES %s NLLOC_OBS %s %s 0' % (phasefile, ttpatter, nllocout) modifyInputFile(ctrf, nllocroot, nllocout, phasef, ttpat)
print ("Modifying NLLoc-control file %s ..." % locfile)
# modification of NLLoc-control file
filedata = None
nllfile = open(locfile, 'r')
filedata = nllfile.read()
if filedata.find(locfiles) < 0:
# replace old command
filedata = filedata.replace('LOCFILES', locfiles)
nllfile = open(locfile, 'w')
nllfile.write(filedata)
nllfile.close()
# locate the event # locate the event
subprocess.call([nlloccall, locfile]) locate(nlloccall, ctrfile)
# !iterative picking if traces remained unpicked or with bad picks! # !iterative picking if traces remained unpicked or occupied with bad picks!
# get theoretical onset times for picks with weights >= 4 # get theoretical onset times for picks with weights >= 4
# in order to reprocess them using smaller time windows # in order to reprocess them using smaller time windows
########################################################## ##########################################################