Retrieving Waveform Data from Various Webservices

There are a couple of different ways to use webservices to download GeoNet data. Here are some examples using the Python Obspy module.

First example is requesting Strong Motion data using FDSN webservices. We remove the instrument response, determine the peak ground acceleration and plot the corrected waveform.

In [1]:
#!/usr/bin/env python

from obspy import UTCDateTime
from obspy.clients.fdsn import Client as FDSN_Client

client = FDSN_Client("GEONET")
t = UTCDateTime("2016-09-01T16:37:00.000")
st = client.get_waveforms("NZ", "TDHS","20", "?N?", t, t + 300,attach_response=True)
pre_filt = (0.005, 0.006, 30.0, 35.0)
st.remove_response(output='ACC', pre_filt=pre_filt)
st.plot()
pga = st.max()
print('PGA (HN1) = %f, PGA (HN2) = %f, PGA (HNZ) = %f m/s/s ' % (pga[0],pga[1],pga[2]))
PGA (HN1) = 1.036797, PGA (HN2) = -1.029480, PGA (HNZ) = -0.363710 m/s/s 

Example of retrieving broadband waveform data from the common waveform buffer.

In [3]:
from obspy.clients.neic import Client as CWB_Client

client = CWB_Client(host='cwb.geonet.org.nz', port=2061, timeout=30, debug=False)
t = UTCDateTime("2016-02-14T00:10:00.000")
st = client.get_waveforms("NZ", "MQZ", "10", "HH?", t, t + 500)
st.plot()
In [10]:
client = FDSN_Client("GEONET")
stime = UTCDateTime("2016-02-13T00:12:00.000")
etime = UTCDateTime("2016-02-14T00:12:00.000")
singlechannel = client.get_waveforms("NZ", "MRNZ","10", "EHZ", stime, etime)
singlechannel.plot(type='dayplot')