Working with Raspberry Shake Data - RJbalikian/SPRIT-HVSR GitHub Wiki

Introduction

The sprit package was designed to work with Raspberry Shake Data from RS3D instruments (3 component seismometers). The below procedure has been tested and works with these instruments, but may need to be modified depending on the specifics of your instrument and/or system.

Field procedure

Since you will likely be doing field deployment of the Raspberry Shake, one of the most important aspects of collecting the data will be an adequate and portable power supply. This can be done through a number of methods. Two common methods are 1) to convert a DC battery source to AC and use the provided AC power supply, or 2) to create a converter from whatever the voltage of your battery source is to the 5.1 Volts (at approximately 2.5-3.0 Amps) needed to power the Shake. Neither is a simple procedure. You will also need a GPS unit as provided by the Raspberry Shake team. This does not (currently) record the devices location (so this will need to be done separately) but syncs the time to UTC time. You will need to record the date and time (in UTC, or sprit can convert for you later) of your recording. This (specifying UTC date and time) is the only way to correlate the data you collected with the site of interest.

Raspberry shake settings

You will need to check that the settings on your instrument are correct to save data. By default, the Raspberry Shake only saves a few days to make sure the storage does not fill up. It deletes data from anytime X days before the present, not by how many total days are saved. That is to say, if you have it set to save for 7 days, and you collect 1 day of data on January 1 and turn it off until January 9 without downloading your data, even though you have only 1 day of data on your Shake, it will delete all data prior to January 2 as soon as you turn on your Shake on January 9. It will also be beneficial to turn on offline mode for when you are collecting data in the field.  

Accessing data on the Raspberry Shake

The Raspberry Shake is essentially a Raspberry Pi computer with additional software and hardware accessories. So, the primary way we connect to the Raspberry Pi/Shake is through SSH, as you might connect between computers. This implies that the computers are on the same network. Either you can connect the Raspberry Shake into a router, etc. and actually connect them to the same network, or you can directly connect the instruments to your computer. In any case, an ethernet cable is usually the way to do this, though there are other ways to do this wirelessly. (see here and/or here for more information)

The data on the Raspberry Shake is stored in the directories at the following path: /opt/data/archive/{year}/{Network}/{Station}/. In this directory are three folders: EHZ.D, EHN.D, EHE.D. These correspond to data acquired by the Z, N, and E components/seismometers in the instrument, respectively. In those folders are files: one file per day.

To transfer files via SSH from one computer (i.e., the Raspberry Shake) to another (i.e., your computer), one of the simplest commands is scp (which stands for secure copy protocol). There are several arguments/options you can use with scp. The most important for us is the recursive option, or -r in this case. The way the scp command is structured is:

scp <options> <source_directory_or_file> <destination_directory_or_file>

This will work on linux terminals and in Powershell on Windows. Other terminals/shells have not been tested.

For us, we need to slightly change the source directory since it's not a filepath on our computer: we need to add something at the start to indicate that it's on the computer we are connected to. For that, we add [email protected] (this is the default for all Raspberry Shakes). So our source directory will look like this, for the year 2023 and a Raspberry Shake with the station id "RS299":

Source directory: [email protected]:/opt/data/archive/2023/AM/RS299/

You will set the destination path on your computer. In this example with the -r option, you will want this to be a folder or directory, not a file. Let's use the example (from windows) of "C:/Users/yourusername/seismicdata". With these paths, our scp command will look like the following:

scp -r [email protected]:/opt/data/archive/2023/AM/RS299/ "C:/Users/yourusername/seismicdata"

You will then get a prompt to enter the password for your Raspberry Shake. By default, this is "shakeme".

This will copy all the contents of the folder and subfolders of your source directory to the destination you have specified, which will copy the data folders and files in the same file structure as what was on the Raspberry Shake. Again, this means the data for any given time will be split into three folders: EHZ.D, EHN.D, EHE.D (these folders will be copied into your destination folder, along with the files inside them).

Working with data copied from a Raspberry Shake

The file names of the data from a Raspberry Shake follow a specific pattern (words inside brackets would be replaced with the actual values):

{NETWORK}.{STATION}.{LOCATION}.{CHANNEL}.{YEAR}.{DAY-OF-YEAR}

There is no extension on these files, but they are in the miniSEED (or mseed) format.

  • NETWORK: Always "AM" for raspberry shakes (for Amateur network)
  • STATION: Each Raspberry Shake has its own station (the example above we used was RS299)
  • LOCATION: This is "00" for all Raspberry Shakes by default
  • CHANNEL: Raspberry Shake channels begin with EH* with the * being replaced by Z, E, or N depending on which direction the channel is facing. See here for more details on channel naming.
  • YEAR: The year the data was acquired
  • DAY-OF-YEAR: The day of year the data was acquired (0-366). For example, February 1 would be the day of year 32 (all are three characters long, so "032" would be what is actually in the filename).

The sprit package is designed to read data from the file structure created by Raspberry Shakes and combine them into one data stream (the Stream class is the basic data structure for the obspy seismic python package). To do this, you will need to specify several parameters to the sprit.input_params() (API docs here) as well as the sprit.fetch_data() (API docs here) function (or simply to the sprit.run() function). These parameters are needed to make sure the right data from the right file is being read for your analysis:

Function Parameter Description
input_params() datapath The path to the directory on your computer within which the EHZ.D, EHE.D, and EHN.D folders are contained.
site OPTIONAL:Name for the site being processed. This is recommended (used for filenames, etc.), but is for convenience only
network The network designation of the instrument ("AM" for all Raspberry Shakes)
station The station designation of the instrument ("RS299" in our example above)
loc The location designation, ("00" by default)
channels The three channel names corresponding to the Z, E, N fields. For Shakes, this is always the same ['EHZ', 'EHN', 'EHE']
acq_date The date your data was acquired. This can be a datetime object or a string, preferred in this format: "2023-10-24"
starttime The time the site acquisition started. Can be datetime.time object or string, preferred format: "HH:MM:SS.microsec"
endtime The time the site acquisition ended. Same format as starttime
tzone The timezone of the above times. By default, "UTC". Will convert to UTC in any case. See here for options. Also listed out in Input tab in GUI
instrument The kind of instrument that was used. Default is "Raspberry Shake", which is what is needed to read raw RS data in
metapath The filepath to the metadata for your data. For raspberry Shakes, this can left as the default, but the SeisCOMP XML format found here is what is used as the default (the XML file will updated to work with the instrument you have specified)
others There are other parameters for input_params(), but they are not part of those needed to read Shake data correctly
fetch_data() source By default, this is set to 'file', but will need to be set to 'raw' to read from the Shake file structure
trim_dir OPTIONAL: A filepath to a directory in which to save a file containing all three component traces combined together and trimmed to the starttime and endtime specified in the input_params() call. This can save work in the future, as it is much easier to read in a single file with all three channels already contained in it then read the data from the Raspberry Shake file structure.
⚠️ **GitHub.com Fallback** ⚠️