This will download continuous seismic waveforms & plot them and requires ObsPy
from obspy import read
from obspy import UTCDateTime
from obspy.clients.fdsn import Client
import obspy as ob
print("# obspy version = ",ob.__version__)
This example uses NCEDC. We can use other dataceneter (e.g., SCEDC, IRIS)
client = Client("NCEDC") # data from NCEDC
#client = Client("SCEDC") # data from SCEDC
#client = Client("IRIS") # data from IRIS
Which SNCL (Station, Network, Component, Location)? This example uses BRK.BK.HHZ.00 data
# BRK BHZ data (https://seismo.berkeley.edu/station_book/brk.html; Haviland Hall)
sta = "BRK" # station
com = "HHZ" # component
net = "BK" # network
loc = "00" # location "--" for blank location code
This example uses 1-min data for the 2020 M3.1 Alum Rock earthquake
# Alum Rock event
#M 3.1 - 8km NE of Alum Rock, CA
#2020-08-02 12:40:24 (UTC)37.409°N 121.755°W7.9 km depth
start_day = "2020-08-02T12:40:24"
end_day = "2020-08-02T12:41:24"
starttime = UTCDateTime(start_day)
endtime = UTCDateTime(end_day)
use get_waveforms to download data and do st.plot() for plotting
st = client.get_waveforms(network=net, station=sta, location=loc, channel=com,
starttime=starttime, endtime=endtime,
attach_response=True)
_plot = st.plot()
use remove_response to correct the instrument response. We can select output unit (displacement, velocity or accerelation)
st.detrend() # remove liner trend
st.taper(max_percentage=0.001) # apply taper
st = st.remove_response( output="VEL" ) # get velocity data (m/s)
#st = st.remove_response( output="DISP" ) # get displacement data (m)
#st = st.remove_response( output="ACC" ) # get acceleration data (m/s^2)
_plot = st.plot()
first remove liner trend, apply a cosin taper, and then do filtering
fl = 5 # in Hz
fh = 10 # in Hz
st.filter(type='bandpass', freqmin=fl, freqmax=fh, corners=6, zerophase=False)
_plot = st.plot()