I’m currently using swarm.bat from the Raspberry Shake Website but when I read in the file, all I get is count on my RS1d. I tried using the obspy library and trying to read in the velocity that way from past forums and it works to gather old data, but I keep getting an error when I try to read in my current RS1D, which is data forwarding.
The code I have set is:
from obspy.clients.fdsn import Client
from obspy.core import UTCDateTime, Stream
rs = Client('RASPISHAKE')
# set the station name and download the response information
stn = 'RASPBERRYSHAKEID ### <<< replace this with your station name ###
inv = rs.get_stations(network='AM', station=stn, level='RESP')
# set data start/end times
start = UTCDateTime(2023, 3, 7, 2, 40, 45) # (YYYY, m, d, H, M, S)
end = UTCDateTime(2023, 3, 7, 2, 42, 0) # (YYYY, m, d, H, M, S)
# set the FDSN server location and channel names
channels = ['ENZ'] # ENx = accelerometer channels; EHx or SHZ = geophone channels
# get waveforms and put them all into one Stream
stream = Stream()
for ch in channels:
trace = rs.get_waveforms('AM', stn, '00', ch, start, end)
stream += trace
# here you will plot raw counts for all four channels
stream.plot()
Also what does level mean and what should I put there?
If there’s any alternative way to read and download the velocity values, that would be great too.
A cursory look at your code tells me it will only give you the raw waveform as is. To get velocity you need to remove the instrument response from the trace.
I would suggest adding something like the following code before the “stream += trace” line.
trace.merge(method=0, fill_value='latest') #fill in any gaps in the data to prevent a crash
trace.detrend(type='demean') #demean the data
filt = [0.7, 0.7, 2, 2.1] #bandpass filter between 0.7 and 2 Hz for example - adjust as you like
trace = trace.remove_response(inventory=inv,pre_filt=filt,output='VEL',water_level=60, plot=False) # convert to Velocity
I have edited how your code was displayed to make it more readable.
As sheeny has suggested, the current code will output the basic raw data from your Shake, so to obtain velocity, you can easily utilize his code and then plot/operate on the resulting trace.
It is possible that you’ll have to change the level=‘RESP’ to level=response to acquire this data without issues if you have the latest ObsPy version installed (v1.3.1). I’ve tested this with my Shake, and it appears to be working:
from obspy.clients.fdsn import Client
from obspy.core import UTCDateTime, Stream
rs = Client('RASPISHAKE')
# set the station name and download the response information
stn = 'R1234` ### <<< replace this with your station name ###
inv = rs.get_stations(network='AM', station=stn, level='response')
# set data start/end times
start = UTCDateTime(2023, 3, 7, 2, 40, 45) # (YYYY, m, d, H, M, S)
end = UTCDateTime(2023, 3, 7, 2, 42, 0) # (YYYY, m, d, H, M, S)
# set the FDSN server location and channel names
channels = ['EHZ'] # ENx = accelerometer channels; EHx or SHZ = geophone channels
# get waveforms and put them all into one Stream
stream = Stream()
for ch in channels:
trace = rs.get_waveforms('AM', stn, '00', ch, start, end)
stream += trace
# here you will plot raw counts for all four channels
stream.plot()