[new] added a function to easily add amplitude information to a given Obspy event object
This commit is contained in:
parent
4e520df145
commit
231e7dafa9
@ -15,6 +15,24 @@ from pylot.core.pick.utils import select_for_phase
|
||||
from pylot.core.util.utils import getOwner, full_range, four_digits
|
||||
|
||||
|
||||
def add_amplitudes(event, amplitudes):
|
||||
amplitude_list = []
|
||||
for pick in event.picks:
|
||||
try:
|
||||
a0 = amplitudes[pick.waveform_id.station_code]
|
||||
amplitude = ope.Amplitude(generic_amplitude=a0 * 1e-3)
|
||||
amplitude.unit = 'm'
|
||||
amplitude.category = 'point'
|
||||
amplitude.waveform_id = pick.waveform_id
|
||||
amplitude.magnitude_hint = 'ML'
|
||||
amplitude.pick_id = pick.resource_id
|
||||
amplitude.type = 'AML'
|
||||
amplitude_list.append(amplitude)
|
||||
except KeyError:
|
||||
continue
|
||||
event.amplitudes = amplitude_list
|
||||
return event
|
||||
|
||||
def readPILOTEvent(phasfn=None, locfn=None, authority_id='RUB', **kwargs):
|
||||
"""
|
||||
readPILOTEvent - function
|
||||
@ -549,4 +567,4 @@ def merge_picks(event, picks):
|
||||
if p.waveform_id.station_code == station and p.phase_hint == phase:
|
||||
p.time, p.time_errors = time, err
|
||||
del time, err, phase, station
|
||||
return event
|
||||
return event
|
||||
|
Loading…
Reference in New Issue
Block a user