Not sure if “developers” is the right category, let me know if not… Anyway, I got a small Python script to do custom plotting with ObsPy, the goal being to live-plot incoming RS3D data (RS is connected over local network). I know about the RSUDP client, which works nicely, but we’d like to do some seismic analysis with ObsPy on the traces that we extract from the shake. First I import some modules
import rsudp.raspberryshake as rs
from obspy.core.stream import Stream
import obspy as obs
from obspy import read
import matplotlib.pyplot as plt
after which I initialize the shake with rs.initRSlib()
. Now, the current problem is that subsequently calling d1 = rs.getDATA()
assigns only one channel’s data to d1
. I thought I could fix that by calling rs.getDATA()
three times in a row, each time assigning the output (a different channel/component) to a different variable: d1, d2, d3, however the order of channels is not the same every time I call this function. One time it may be Z, N, E, the other time it may be Z, E, N. Or more problematic, it even extracts the same component twice in three calls of rs.getDATA()
.
This may be unnecessary to mention, but just to be sure, the next steps are to extract a trace for each channel, which I can then plot with ObsPy.
tr1 = rs.make_trace(d1)
tr2 = rs.make_trace(d2)
tr3 = rs.make_trace(d3)
Is there a robust way to extract the trace data for each component separately, every time I refresh the data import?