mseed2seg - Selects from a MiniSeed archive and converts to BSEGY format, ASCII, and Gnuplot
mseed2seg [ -h | infile | scansw | station | channel | network | location | samprate ]
Basic Seismic Utilities (BSU) reads a MiniSeed file format (see https://www.iris.edu) from a file with one or more recordings. Options can be used to select a particular recording and build a seismic trace which is then output as a BSEGY file. Due to the number of sample limitation in the BSEGY header (at most 65535 samples) longer traces are broken up into a sequence of traces and stored in the BSEGY file making it look like a multi-trace file. The first trace starts at the origin time, and each additional trace simply continues in time with the last trace ending at the latest recorded time, subject to a requirement that all traces be the same size. A search is made for the largest trace length with the smallest remainder. The smaller the remainder, the less data will be dropped at the end.
In addition, all the data are output as an ASCII file ending in *.dat. This permits one to import into MATLAB or OCTAVE as an alternative to BSEGY. Further, a GNUPLOT script is generated to read the *.dat file and generate a plot of the entire signal. The program employs the library, libmseed, which needs to be installed, either with your package manager or by download (https://github.com/iris-edu/libmseed).
A typical application of the code is to first scan an archive file using scansw = 1 or some other value (greater than zero depending on the level of detail desired). This will create a *.lst file which can be examined to determine how to set the other parameters when extracting data. This code breaks with the other BSU codes in that it allows long file names for the input parameter, infile. C-language version .
Options
-h |
Online help giving details on command line arguments | ||
infile |
Input file name (must be greater than or equal to 4 char, 131 char maximum). | ||
scansw |
=0 apply filters, extract waveform data (int) |
=1 scan headers only, 1 line
per record (int)
=2 scan headers only, more detail (int)
=3+ scan headers only, with increasing detail (int)
station
Name of station desired, character, typically 3 to 4 char.
channel
Channel desired. Examples:
BHZ = vertical component
BHE = East component
BHN = North component
(see Miniseed documentation for details on naming
conventions)
network
Desired network (typically 2 characters). Or use "x" to match all networks.
location
Desired location. There can be more than one location at a station. Typically 2 char. Or you can enter "x" to select all locations. This can result in more than one signal mixed together, so watch out.
samprate
Desired sample rate (double). Example 40.0 is 40 samples per second.
NOTE:
If invoked with no options, will prompt user for input
parameters.
EXAMPLE:
mseed2seg 2020-03-31-ml68-western-idaho.miniseed 0 COR BHZ
IU 10 40.
Selects data from Corvalis Oregon station, vertical component, network IU, location 10, 40 samples per second.
standard output
produces a progress bar
CORBHZ.lst
Name convention is unusual for BSU. First 3 to 4 characters are the station. Next 3 characters are the channel. Suffix is type of file (see examples below for above example). The *.lst file is a check of input parameters and output of a scan.
CORBHZ.seg
The BSEGY formatted file.
CORBHZ.dat
ASCII file with entire data in trace. Hashes are comments about the segments that have built the trace. There are two columns, (sample time, data value). If hashes are a problem for some use like in Octave or Matlab, run a command like this:
cat CORBHZ.dat | gawk ’ !/#/ {print $0 }’ >datafile
CORBHZ.gp
Gnuplot script to plot the entire signal. Produces a Postscript output by default. To view with persistence in X11, use -p option. Example
gnuplot -p CORBHZ.gp
The title will show Station, Channel, time of day for first sample, and date mm/day/yr.
bhelp(1), gnuplot(1), ms_readmsr(3), ms_log(3), msr_print(3), ms_hptime2btime(3)
No known bugs.
Copyright © 2022 by Paul Michaels
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
P. Michaels, PE. <[email protected]>