In [1]:
import numpy as np                
import matplotlib.pyplot as plt   
import obspy                      

%matplotlib inline
plt.style.use('ggplot')#'seaborn-whitegrid')
plt.rcParams['figure.figsize'] = 10, 5
In [2]:
from obspy import UTCDateTime
from obspy.clients.fdsn import Client
In [3]:
#M 2.1 - 3km W of Concord, CA
#2020-03-17 04:16:49 (UTC)37.968°N 122.045°W12.9 km depth
fdsn_client = Client("NCEDC")
net_code = "BK"
sta_code = "BRK"            

# get data
starttime = UTCDateTime(2020, 3, 17, 2, 0, 0)
endtime =   UTCDateTime(2020, 3, 17, 7, 0, 0)

# plot
starttime2 = UTCDateTime(2020, 3, 17, 3, 30, 0)
endtime2 =  UTCDateTime(2020, 3, 17, 5, 30, 0)
In [4]:
st = fdsn_client.get_waveforms(network=net_code, station=sta_code, location="00", channel="HHZ",
                     starttime=starttime, endtime=endtime, 
                     attach_response=True)

st = st.remove_response( output="VEL" )
st.detrend()
st.taper(max_percentage=0.001)
/anaconda3/envs/netops/lib/python3.7/site-packages/obspy/io/stationxml/core.py:84: UserWarning: The StationXML file has version 1.1, ObsPy can deal with version 1.0. Proceed with caution.
  root.attrib["schemaVersion"], SCHEMA_VERSION))
Out[4]:
1 Trace(s) in Stream:
BK.BRK.00.HHZ | 2020-03-17T02:00:00.008391Z - 2020-03-17T06:59:59.998391Z | 100.0 Hz, 1800000 samples
In [5]:
st2 = st.copy()
fl = 1
fh = 10
title = st2[0].id+" (BP filter: "+str(fl)+"-"+str(fh)+"Hz)"
st2.slice(starttime=starttime2,
    endtime=endtime2).filter(
    "bandpass", freqmin=fl, freqmax=fh).plot(type='dayplot', interval=10, title=title)
Out[5]:
In [6]:
st2 = st.copy()
fl = 5
fh = 10
title = st2[0].id+" (BP filter: "+str(fl)+"-"+str(fh)+"Hz)"
st2.slice(starttime=starttime2,
    endtime=endtime2).filter(
    "bandpass", freqmin=fl, freqmax=fh).plot(type='dayplot', interval=10, title=title)
Out[6]:
In [7]:
st2 = st.copy()
fl = 10
fh = 20
title = st2[0].id+" (BP filter: "+str(fl)+"-"+str(fh)+"Hz)"
st2.slice(starttime=starttime2,
    endtime=endtime2).filter(
    "bandpass", freqmin=fl, freqmax=fh).plot(type='dayplot', interval=10, title=title)
Out[7]:
In [ ]:
 
In [ ]:
 
In [ ]: