rsudp.packetize
(data formatter)
The packetize
module is a utility that turns miniSEED data into text files
containing the Raspberry Shake UDP data format (see Producer-consumer message passing).
It can be run either from another python module using the
rsudp.packetize.packetize()
function, or from the command line.
Python usage:
from rsudp.packetize import packetize
packetize('test.mseed', 'output.txt')
Command line usage:
conda activate rsudp
python packetize.py -i test.mseed -o output.txt
Note
Command line usage must be done from within an environment in which
obspy
is installed as a python3 package.
- rsudp.packetize.cutoff_calc(stream)
Return the number of samples that will be transcribed to UDP packet formatted ascii text. Iterates over each trace in the stream to make this calculation.
- Parameters:
stream (obspy.core.stream.Stream) – Stream object to calculate number of samples from
- Return type:
- Returns:
the number of samples to transcribe, 2) the number of samples in each packet
- rsudp.packetize.get_samps(stream)
Return the number of samples to place in each packet. This number is based on the sampling frequency of the data in question.
Raspberry Shake data is sent to the UDP port either in packets of 25 (for sampling frequency of 100 Hz) or 50 (for frequency of 50 Hz).
This is hardcoded and will not change for the foreseeable future, which means that it can be used to determine the variety of sensor used (50 Hz is the original versions of RS1D).
- Parameters:
stream (obspy.core.stream.Stream) – Stream object to calculate samples per packet for
- Return type:
- Returns:
the number of samples per packet (either 25 or 50)
- rsudp.packetize.main()
This function reads command line arguments, then calls
rsudp.packetize.packetize()
with those arguments.
- rsudp.packetize.packetize(inf, outf, testing=False)
Reads a seismic data file and converts it to ascii text.