[fix] some bugs found and fixed
This commit is contained in:
parent
019a3ae0f3
commit
d68a1bcf0e
32
autoPyLoT.py
32
autoPyLoT.py
@ -16,7 +16,8 @@ from pylot.core.io.data import Data
|
|||||||
from pylot.core.io.inputs import AutoPickParameter
|
from pylot.core.io.inputs import AutoPickParameter
|
||||||
from pylot.core.io.phases import add_amplitudes
|
from pylot.core.io.phases import add_amplitudes
|
||||||
from pylot.core.pick.autopick import autopickevent, iteratepicker
|
from pylot.core.pick.autopick import autopickevent, iteratepicker
|
||||||
from pylot.core.util.dataprocessing import restitute_data, read_metadata
|
from pylot.core.util.dataprocessing import restitute_data, read_metadata, \
|
||||||
|
remove_underscores
|
||||||
from pylot.core.util.structure import DATASTRUCTURE
|
from pylot.core.util.structure import DATASTRUCTURE
|
||||||
from pylot.core.util.version import get_git_version as _getVersionString
|
from pylot.core.util.version import get_git_version as _getVersionString
|
||||||
|
|
||||||
@ -113,6 +114,7 @@ def autoPyLoT(inputfile):
|
|||||||
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
|
||||||
|
wfdat = remove_underscores(wfdat)
|
||||||
metadata = read_metadata(parameter.get('invdir'))
|
metadata = read_metadata(parameter.get('invdir'))
|
||||||
corr_dat, rest_flag = restitute_data(wfdat.copy(), *metadata)
|
corr_dat, rest_flag = restitute_data(wfdat.copy(), *metadata)
|
||||||
##########################################################
|
##########################################################
|
||||||
@ -152,18 +154,20 @@ def autoPyLoT(inputfile):
|
|||||||
if len(glob.glob(locsearch)) > 0:
|
if len(glob.glob(locsearch)) > 0:
|
||||||
# get latest NLLoc-location file if several are available
|
# get latest NLLoc-location file if several are available
|
||||||
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
|
nllocfile = max(glob.glob(locsearch), key=os.path.getctime)
|
||||||
evt = read_events(nllocfile)
|
evt = read_events(nllocfile)[0]
|
||||||
# calculating seismic moment Mo and moment magnitude Mw
|
# calculating seismic moment Mo and moment magnitude Mw
|
||||||
moment_mag = MomentMagnitude(corr_dat, evt, parameter.get('vp'),
|
moment_mag = MomentMagnitude(corr_dat, evt, parameter.get('vp'),
|
||||||
parameter.get('Qp'), parameter.get('rho'), True, 2)
|
parameter.get('Qp'),
|
||||||
local_mag = RichterMagnitude(corr_dat, evt, parameter.get('sstop'), True, 2)
|
parameter.get('rho'), True, 0)
|
||||||
for station, amplitude in local_mag.amplitudes:
|
local_mag = RichterMagnitude(corr_dat, evt,
|
||||||
|
parameter.get('sstop'), True, 0)
|
||||||
|
for station, amplitude in local_mag.amplitudes.items():
|
||||||
picks[station]['S']['Ao'] = amplitude
|
picks[station]['S']['Ao'] = amplitude
|
||||||
evt = add_amplitudes(evt, local_mag.amplitudes)
|
evt = add_amplitudes(evt, local_mag.amplitudes)
|
||||||
netML = local_mag.net_magnitude()
|
netML = local_mag.net_magnitude()
|
||||||
netMw = moment_mag.net_magnitude()
|
netMw = moment_mag.net_magnitude()
|
||||||
evt.origins[0].magnitudes.append(netMw)
|
mags = [netML, netMw]
|
||||||
evt.origins[0].magnitudes.append(netML)
|
evt.magnitudes += mags
|
||||||
else:
|
else:
|
||||||
print("autoPyLoT: No NLLoc-location file available!")
|
print("autoPyLoT: No NLLoc-location file available!")
|
||||||
print("No source parameter estimation possible!")
|
print("No source parameter estimation possible!")
|
||||||
@ -200,19 +204,21 @@ def autoPyLoT(inputfile):
|
|||||||
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!")
|
||||||
nlloccounter = maxnumit
|
nlloccounter = maxnumit
|
||||||
evt = read_events(nllocfile)
|
evt = read_events(nllocfile)[0]
|
||||||
# calculating seismic moment Mo and moment magnitude Mw
|
# calculating seismic moment Mo and moment magnitude Mw
|
||||||
moment_mag = MomentMagnitude(corr_dat, evt, parameter.get('vp'),
|
moment_mag = MomentMagnitude(corr_dat, evt, parameter.get('vp'),
|
||||||
parameter.get('Qp'), parameter.get('rho'), True, 2)
|
parameter.get('Qp'),
|
||||||
local_mag = RichterMagnitude(corr_dat, evt, parameter.get('sstop'), True, 2)
|
parameter.get('rho'), True, 0)
|
||||||
for station, amplitude in local_mag.amplitudes:
|
local_mag = RichterMagnitude(corr_dat, evt,
|
||||||
|
parameter.get('sstop'), True, 0)
|
||||||
|
for station, amplitude in local_mag.amplitudes.items():
|
||||||
picks[station]['S']['Ao'] = amplitude
|
picks[station]['S']['Ao'] = amplitude
|
||||||
evt = add_amplitudes(evt, local_mag.amplitudes)
|
evt = add_amplitudes(evt, local_mag.amplitudes)
|
||||||
netML = local_mag.net_magnitude()
|
netML = local_mag.net_magnitude()
|
||||||
# get network moment magntiude
|
# get network moment magntiude
|
||||||
netMw = moment_mag.net_magnitude()
|
netMw = moment_mag.net_magnitude()
|
||||||
evt.origins[0].magnitudes.append(netMw)
|
mags = [netML, netMw]
|
||||||
evt.origins[0].magnitudes.append(netML)
|
evt.magnitudes += mags
|
||||||
print("Network moment magnitude: %4.1f" % netMw.mag)
|
print("Network moment magnitude: %4.1f" % netMw.mag)
|
||||||
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