Finished iterative picking: If bad picks are found, autoPyLoT iteratively re-picks these traces with modified picking parameters at maximum three times, if the former runs still leave bad picks.
This commit is contained in:
parent
574c26c3ec
commit
e5bddab2be
67
autoPyLoT.py
67
autoPyLoT.py
@ -133,14 +133,32 @@ def autoPyLoT(inputfile):
|
|||||||
else:
|
else:
|
||||||
# get theoretical P-onset times from NLLoc-location file
|
# get theoretical P-onset times from NLLoc-location file
|
||||||
locsearch = '%s/loc/%s.????????.??????.grid?.loc.hyp' % (nllocroot, nllocout)
|
locsearch = '%s/loc/%s.????????.??????.grid?.loc.hyp' % (nllocroot, nllocout)
|
||||||
# get latest file if several are available
|
maxnumit = 3 # maximum number of iterations
|
||||||
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
|
if len(glob.glob(locsearch)) > 0:
|
||||||
if os.path.isfile(nllocfile):
|
# get latest file if several are available
|
||||||
picks = iteratepicker(wfdat, nllocfile, picks, badpicks, parameter)
|
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
|
||||||
# write phases to NLLoc-phase file
|
nlloccounter = 0
|
||||||
picksExport(picks, 'NLLoc', phasefile)
|
while len(badpicks) > 0 and nlloccounter <= maxnumit:
|
||||||
# locate the event
|
nlloccounter += 1
|
||||||
locate(nlloccall, ctrfile)
|
if nlloccounter > maxnumit:
|
||||||
|
print("autoPyLoT: Number of maximum iterations reached, stop iterative picking!")
|
||||||
|
break
|
||||||
|
print("autoPyLoT: Starting with iteration No. %d ..." % nlloccounter)
|
||||||
|
picks = iteratepicker(wfdat, nllocfile, picks, badpicks, parameter)
|
||||||
|
# write phases to NLLoc-phase file
|
||||||
|
picksExport(picks, 'NLLoc', phasefile)
|
||||||
|
# locate the event
|
||||||
|
locate(nlloccall, ctrfile)
|
||||||
|
print("autoPyLoT: Iteration No. %d finished." % nlloccounter)
|
||||||
|
badpicks = []
|
||||||
|
for key in picks:
|
||||||
|
if picks[key]['P']['weight'] >= 4 or picks[key]['S']['weight'] >= 4:
|
||||||
|
badpicks.append([key, picks[key]['P']['mpp']])
|
||||||
|
print("autoPyLoT: After iteration No. %d: %d bad onsets found ..." % (nlloccounter, \
|
||||||
|
len(badpicks)))
|
||||||
|
if len(badpicks) == 0:
|
||||||
|
print("autoPyLoT: No more bad onsets found, stop iterative picking!")
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
print("autoPyLoT: No NLLoc-location file available! Stop iteration!")
|
print("autoPyLoT: No NLLoc-location file available! Stop iteration!")
|
||||||
##########################################################
|
##########################################################
|
||||||
@ -195,14 +213,33 @@ def autoPyLoT(inputfile):
|
|||||||
else:
|
else:
|
||||||
# get theoretical P-onset times from NLLoc-location file
|
# get theoretical P-onset times from NLLoc-location file
|
||||||
locsearch = '%s/loc/%s.????????.??????.grid?.loc.hyp' % (nllocroot, nllocout)
|
locsearch = '%s/loc/%s.????????.??????.grid?.loc.hyp' % (nllocroot, nllocout)
|
||||||
# get latest file if several are available
|
|
||||||
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
|
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
|
||||||
if os.path.isfile(nllocfile):
|
maxnumit = 3 # maximum number of iterations
|
||||||
picks = iteratepicker(wfdat, nllocfile, picks, badpicks, parameter)
|
if len(glob.glob(locsearch)) > 0:
|
||||||
# write phases to NLLoc-phase file
|
# get latest file if several are available
|
||||||
picksExport(picks, 'NLLoc', phasefile)
|
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
|
||||||
# locate the event
|
nlloccounter = 0
|
||||||
locate(nlloccall, ctrfile)
|
while len(badpicks) > 0 and nlloccounter <= maxnumit:
|
||||||
|
nlloccounter += 1
|
||||||
|
if nlloccounter > maxnumit:
|
||||||
|
print("autoPyLoT: Number of maximum iterations reached, stop iterative picking!")
|
||||||
|
break
|
||||||
|
print("autoPyLoT: Starting with iteration No. %d ..." % nlloccounter)
|
||||||
|
picks = iteratepicker(wfdat, nllocfile, picks, badpicks, parameter)
|
||||||
|
# write phases to NLLoc-phase file
|
||||||
|
picksExport(picks, 'NLLoc', phasefile)
|
||||||
|
# locate the event
|
||||||
|
locate(nlloccall, ctrfile)
|
||||||
|
print("autoPyLoT: Iteration No. %d finished." % nlloccounter)
|
||||||
|
badpicks = []
|
||||||
|
for key in picks:
|
||||||
|
if picks[key]['P']['weight'] >= 4 or picks[key]['S']['weight'] >= 4:
|
||||||
|
badpicks.append([key, picks[key]['P']['mpp']])
|
||||||
|
print("autoPyLoT: After iteration No. %d: %d bad onsets found ..." % (nlloccounter, \
|
||||||
|
len(badpicks)))
|
||||||
|
if len(badpicks) == 0:
|
||||||
|
print("autoPyLoT: No more bad onsets found, stop iterative picking!")
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
print("autoPyLoT: No NLLoc-location file available! Stop iteration!")
|
print("autoPyLoT: No NLLoc-location file available! Stop iteration!")
|
||||||
##########################################################
|
##########################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user