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