[add] continue if no station coords
[bugfix] return if no isignal window
This commit is contained in:
parent
fe2a2a9714
commit
e6aa1ad031
@ -24,7 +24,7 @@ from pylot.core.util.utils import getPatternLine, gen_Pool, identifyPhase, loopI
|
|||||||
from obspy.taup import TauPyModel
|
from obspy.taup import TauPyModel
|
||||||
|
|
||||||
|
|
||||||
def autopickevent(data, param, iplot=0, fig_dict=None, ncores=0, metadata=None, origin=None):
|
def autopickevent(data, param, iplot=0, fig_dict=None, ncores=1, metadata=None, origin=None):
|
||||||
stations = []
|
stations = []
|
||||||
all_onsets = {}
|
all_onsets = {}
|
||||||
input_tuples = []
|
input_tuples = []
|
||||||
@ -87,6 +87,15 @@ def call_autopickstation(input_tuple):
|
|||||||
return autopickstation(wfstream, pickparam, verbose, iplot=0, metadata=metadata, origin=origin)
|
return autopickstation(wfstream, pickparam, verbose, iplot=0, metadata=metadata, origin=origin)
|
||||||
|
|
||||||
|
|
||||||
|
def get_source_coords(parser, station_id):
|
||||||
|
station_coords = None
|
||||||
|
try:
|
||||||
|
station_coords = parser.get_coordinates(station_id)
|
||||||
|
except Exception as e:
|
||||||
|
print('Could not get source coordinates for station {}: {}'.format(station_id, e))
|
||||||
|
return station_coords
|
||||||
|
|
||||||
|
|
||||||
def autopickstation(wfstream, pickparam, verbose=False,
|
def autopickstation(wfstream, pickparam, verbose=False,
|
||||||
iplot=0, fig_dict=None, metadata=None, origin=None):
|
iplot=0, fig_dict=None, metadata=None, origin=None):
|
||||||
"""
|
"""
|
||||||
@ -224,11 +233,11 @@ def autopickstation(wfstream, pickparam, verbose=False,
|
|||||||
if not metadata[1]:
|
if not metadata[1]:
|
||||||
print('Warning: Could not use TauPy to estimate onsets as there are no metadata given.')
|
print('Warning: Could not use TauPy to estimate onsets as there are no metadata given.')
|
||||||
else:
|
else:
|
||||||
if origin:
|
|
||||||
source_origin = origin[0]
|
|
||||||
station_id = wfstream[0].get_id()
|
station_id = wfstream[0].get_id()
|
||||||
parser = metadata[1]
|
parser = metadata[1]
|
||||||
station_coords = parser.get_coordinates(station_id)
|
station_coords = get_source_coords(parser, station_id)
|
||||||
|
if station_coords and origin:
|
||||||
|
source_origin = origin[0]
|
||||||
model = TauPyModel(taup_model)
|
model = TauPyModel(taup_model)
|
||||||
arrivals = model.get_travel_times_geo(
|
arrivals = model.get_travel_times_geo(
|
||||||
source_origin.depth,
|
source_origin.depth,
|
||||||
@ -254,9 +263,8 @@ def autopickstation(wfstream, pickparam, verbose=False,
|
|||||||
Lc = pstop - pstart
|
Lc = pstop - pstart
|
||||||
print('autopick: CF calculation times respectively:'
|
print('autopick: CF calculation times respectively:'
|
||||||
' pstart: {} s, pstop: {} s'.format(pstart, pstop))
|
' pstart: {} s, pstop: {} s'.format(pstart, pstop))
|
||||||
else:
|
elif not origin:
|
||||||
print('No source origins given!')
|
print('No source origins given!')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
Lc = pstop - pstart
|
Lc = pstop - pstart
|
||||||
Lwf = zdat[0].stats.endtime - zdat[0].stats.starttime
|
Lwf = zdat[0].stats.endtime - zdat[0].stats.starttime
|
||||||
|
@ -219,11 +219,13 @@ class AICPicker(AutoPicker):
|
|||||||
# check, if these are counts or m/s, important for slope estimation!
|
# check, if these are counts or m/s, important for slope estimation!
|
||||||
# this is quick and dirty, better solution?
|
# this is quick and dirty, better solution?
|
||||||
if max(self.Data[0].data < 1e-3) and max(self.Data[0].data >= 1e-6):
|
if max(self.Data[0].data < 1e-3) and max(self.Data[0].data >= 1e-6):
|
||||||
self.Data[0].data = self.Data[0].data * 1000000
|
self.Data[0].data = self.Data[0].data * 1000000.
|
||||||
elif max(self.Data[0].data < 1e-6):
|
elif max(self.Data[0].data < 1e-6):
|
||||||
self.Data[0].data = self.Data[0].data * 1e13
|
self.Data[0].data = self.Data[0].data * 1e13
|
||||||
# get signal window
|
# get signal window
|
||||||
isignal = getsignalwin(self.Tcf, self.Pick, self.TSNR[2])
|
isignal = getsignalwin(self.Tcf, self.Pick, self.TSNR[2])
|
||||||
|
if len(isignal) == 0:
|
||||||
|
return
|
||||||
ii = min([isignal[len(isignal) - 1], len(self.Tcf)])
|
ii = min([isignal[len(isignal) - 1], len(self.Tcf)])
|
||||||
isignal = isignal[0:ii]
|
isignal = isignal[0:ii]
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user