Implemented modified class MoMw of object magnitude.

This commit is contained in:
Ludger Küperkoch 2015-12-01 15:39:28 +01:00
parent ed7a323c50
commit c3d7581f94

View File

@ -88,9 +88,10 @@ def autoPyLoT(inputfile):
maxnumit = 3 # maximum number of iterations for re-picking maxnumit = 3 # maximum number of iterations for re-picking
else: else:
locflag = 0 locflag = 0
print (" !!! ") print(" !!! ")
print ("!!No location routine available, autoPyLoT is running in non-location mode!!") print("!!No location routine available, autoPyLoT is running in non-location mode!!")
print (" !!! ") print("!!No source parameter estimation possible!!")
print(" !!! ")
# multiple event processing # multiple event processing
@ -132,6 +133,17 @@ def autoPyLoT(inputfile):
if len(badpicks) == 0: if len(badpicks) == 0:
print("autoPyLoT: No bad onsets found, thus no iterative picking necessary!") print("autoPyLoT: No bad onsets found, thus no iterative picking necessary!")
# get NLLoc-location file
locsearch = '%s/loc/%s.????????.??????.grid?.loc.hyp' % (nllocroot, nllocout)
if len(glob.glob(locsearch)) > 0:
# get latest NLLoc-location file if several are available
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
# calculating seismic moment Mo and moment magnitude Mw
M0Mw(wfdat, None, None, None, nllocfile, picks, \
parameter.getParam('rho'), parameter.getParam('vp'))
else:
print("autoPyLoT: No NLLoc-location file available!")
print("No source parameter estimation possible!")
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)
@ -151,6 +163,9 @@ def autoPyLoT(inputfile):
# locate the event # locate the event
locate(nlloccall, ctrfile) locate(nlloccall, ctrfile)
print("autoPyLoT: Iteration No. %d finished." % nlloccounter) print("autoPyLoT: Iteration No. %d finished." % nlloccounter)
# get updated NLLoc-location file
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
# check for bad picks
badpicks = [] badpicks = []
for key in picks: for key in picks:
if picks[key]['P']['weight'] >= 4 or picks[key]['S']['weight'] >= 4: if picks[key]['P']['weight'] >= 4 or picks[key]['S']['weight'] >= 4:
@ -159,15 +174,10 @@ def autoPyLoT(inputfile):
len(badpicks))) len(badpicks)))
if len(badpicks) == 0: if len(badpicks) == 0:
print("autoPyLoT: No more bad onsets found, stop iterative picking!") print("autoPyLoT: No more bad onsets found, stop iterative picking!")
break nlloccounter = maxnumit
# calculating seismic moment Mo and corresponding moment
# magnitude Mw after Hanks and Kanamori (1979) from reliable # calculating seismic moment Mo and moment magnitude Mw
# picks/waveforms finalpicks = M0Mw(wfdat, None, None, None, nllocfile, picks, \
for key in picks:
if picks[key]['P']['weight'] < 4 and picks[key]['P']['w0'] is not None:
selwf = wfdat.select(station=key)
w0 = picks[key]['P']['w0']
sourcepara = M0Mw(selwf, None, None, None, w0, 5, \
parameter.getParam('rho'), parameter.getParam('vp')) parameter.getParam('rho'), parameter.getParam('vp'))
else: else:
print("autoPyLoT: No NLLoc-location file available! Stop iteration!") print("autoPyLoT: No NLLoc-location file available! Stop iteration!")
@ -175,7 +185,7 @@ def autoPyLoT(inputfile):
# write phase files for various location routines # write phase files for various location routines
# HYPO71 # HYPO71
hypo71file = '%s/%s/autoPyLoT_HYPO71.pha' % (datapath, evID) hypo71file = '%s/%s/autoPyLoT_HYPO71.pha' % (datapath, evID)
writephases(picks, 'HYPO71', hypo71file) writephases(finalpicks.getpicdic(), 'HYPO71', hypo71file)
endsplash = '''------------------------------------------\n' endsplash = '''------------------------------------------\n'
-----Finished event %s!-----\n' -----Finished event %s!-----\n'
@ -220,6 +230,17 @@ def autoPyLoT(inputfile):
if len(badpicks) == 0: if len(badpicks) == 0:
print("autoPyLoT: No bad onsets found, thus no iterative picking necessary!") print("autoPyLoT: No bad onsets found, thus no iterative picking necessary!")
# get NLLoc-location file
locsearch = '%s/loc/%s.????????.??????.grid?.loc.hyp' % (nllocroot, nllocout)
if len(glob.glob(locsearch)) > 0:
# get latest NLLOc-location file if several are available
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
# calculating seismic moment Mo and moment magnitude Mw
M0Mw(wfdat, None, None, None, nllocfile, picks, \
parameter.getParam('rho'), parameter.getParam('vp'))
else:
print("autoPyLoT: No NLLoc-location file available!")
print("No source parameter estimation possible!")
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)
@ -239,6 +260,9 @@ def autoPyLoT(inputfile):
# locate the event # locate the event
locate(nlloccall, ctrfile) locate(nlloccall, ctrfile)
print("autoPyLoT: Iteration No. %d finished." % nlloccounter) print("autoPyLoT: Iteration No. %d finished." % nlloccounter)
# get updated NLLoc-location file
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
# check for bad picks
badpicks = [] badpicks = []
for key in picks: for key in picks:
if picks[key]['P']['weight'] >= 4 or picks[key]['S']['weight'] >= 4: if picks[key]['P']['weight'] >= 4 or picks[key]['S']['weight'] >= 4:
@ -247,25 +271,18 @@ def autoPyLoT(inputfile):
len(badpicks))) len(badpicks)))
if len(badpicks) == 0: if len(badpicks) == 0:
print("autoPyLoT: No more bad onsets found, stop iterative picking!") print("autoPyLoT: No more bad onsets found, stop iterative picking!")
break nlloccounter = maxnumit
# calculating seismic moment Mo and corresponding moment # calculating seismic moment Mo and moment magnitude Mw
# magnitude Mw after Hanks and Kanamori (1979) from reliable finalpicks = M0Mw(wfdat, None, None, None, nllocfile, picks, \
# picks/waveforms
for key in picks:
if picks[key]['P']['weight'] < 4 and picks[key]['P']['w0'] is not None:
selwf = wfdat.select(station=key)
w0 = picks[key]['P']['w0']
sourcepara = M0Mw(selwf, None, None, None, w0, 5, \
parameter.getParam('rho'), parameter.getParam('vp')) parameter.getParam('rho'), parameter.getParam('vp'))
else: else:
print("autoPyLoT: No NLLoc-location file available! Stop iteration!") print("autoPyLoT: No NLLoc-location file available! Stop iteration!")
########################################################## ##########################################################
# write phase files for various location routines # write phase files for various location routines
# HYPO71 # HYPO71
hypo71file = '%s/%s/autoPyLoT_HYPO71.pha' % (datapath, parameter.getParam('eventID')) hypo71file = '%s/%s/autoPyLoT_HYPO71.pha' % (datapath, parameter.getParam('eventID'))
writephases(picks, 'HYPO71', hypo71file) writephases(finalpicks.getpicdic(), 'HYPO71', hypo71file)
endsplash = '''------------------------------------------\n' endsplash = '''------------------------------------------\n'
-----Finished event %s!-----\n' -----Finished event %s!-----\n'