-
Notifications
You must be signed in to change notification settings - Fork 9
PH5 Web Services Shot Gather
Nick Falco edited this page Aug 9, 2017
·
31 revisions
For active (controlled) source experiments, users may wish to request data from PH5 Web Services as a Common Shot Order Gather. Below is an example one way that this can be achieved using ObsPy.
from obspy.clients import fdsn
from obspy import UTCDateTime
from obspy.geodetics.base import gps2dist_azimuth
# Use ph5ws-station to retrieve ZI (15-017) station metadata
STATION = 'http://service.iris.edu/ph5ws/station/1'
c = fdsn.client.Client('http://service.iris.edu',
service_mappings={
'station': STATION
},
debug=True
)
inventory = c.get_stations(network='ZI', station='*',
location='--', channel='DPZ',
level='response',
starttime=UTCDateTime('2015-06-29T01:00:00.0'),
endtime=UTCDateTime('2015-06-29T09:00:00.0'))
# Use ph5ws-event to retrieve ZI (15-017) event metadata
EVENT = 'http://service.iris.edu/ph5ws/event/1'
c = fdsn.client.Client('http://service.iris.edu',
service_mappings={
'event': EVENT
},
debug=True
)
events = c.get_events(catalog='ZI',
starttime=UTCDateTime('2015-06-29T01:00:00.0'),
endtime=UTCDateTime('2015-06-29T09:00:00.0'))
# Use ph5ws-dataselect to retrieve ZI (15-017) waveform data
DATASELECT = 'http://service.iris.edu/ph5ws/dataselect/1'
c = fdsn.client.Client('http://service.iris.edu',
service_mappings={
'dataselect': DATASELECT
},
debug=True
)
stream = c.get_waveforms(network='ZI', station='*',
location='--', channel='DPZ',
starttime=events[0].origins[0].time,
endtime=events[0].origins[0].time+60)
stream.attach_response(inventory)
# Compute the distance from the source for each channel
for trace in stream:
for station in inventory[0]:
for channel in station:
if trace.stats.station == station.code and \
trace.stats.location == channel.location_code and \
trace.stats.channel == channel.code:
trace.stats.distance = gps2dist_azimuth(
events[0].origins[0].latitude,
events[0].origins[0].longitude,
channel.latitude,
channel.longitude)[0]
# Order the traces by distance from the source
stream.traces.sort(key=lambda x: x.stats.distance)
stream.plot(type='section',
size=(800, 1024))