You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

267 lines
7.6 KiB
ReStructuredText

.. highlight:: rst
.. _scart:
#####
scart
#####
**Import/export MiniSEED data to/from SDS archives.**
Description
===========
The archive tool scart reads and writes :term:`SDS` archives and files
in miniSEED format and checks miniSEED archives or prints stream information.
* **Dump mode:** Create miniSEED files (multiplexed), e.g. for playbacks, from
:term:`SDS` structured data (e.g. created by slarchive) or from data passed
from another record source such as :ref:`Arclink <rs-arclink>`.
* **Dump mode:** Play back records directly out of an SDS structure.
* **Import mode:** Import multiplexed miniSEED files into a local SDS waveform
archive.
* **Check mode:** Check an archive of miniSEED files for out-of-order records in
files.
.. warning::
* When creating :term:`SDS` archives, scart simply appends the new records to
existing ones. Multiple imports of the same data result in duplication.
* Out-of-order imports of waveforms into a SDS archive result in out-of-order
records which may not be processed. Clean your archive using :ref:`scmssort`.
* The new input data for an SDS archive must be sorted by time. Otherwise,
the SDS archive may not be correctly readable. Combine scart with
:ref:`scmssort` for multiplexing and removal of duplicates.
.. hint::
In dump mode output streams may be controlled by
* Time window - stream lists (:option:`--list`, dump mode) generated by
:ref:`scevtstreams` for particular events
* NSLC lists (:option:`--nslc`) created, e.g., with :ref:`scinv` from
inventories.
.. _scart-config:
Configuration
=============
scart can make use of :ref:`global_recordstream`
implementations which are provided by additional plugins.
For loading additional plugins, e.g. the *xyz* plugin create and configure :file:`scart.cfg`:
.. code-block:: sh
plugins = xyz
Examples
========
#. Extract data from the default :term:`SDS` archive in :file:`$SEISCOMP_ROOT/var/lib/archive`
or from a local :term:`SDS` archive [SDS archive] into a miniSEED file :file:`file.mseed`
and sort by end time of the records:
.. code-block:: sh
scart -dsvE -t '[start-time]~[end-time]' > file.mseed
scart -dsvE -t '[start-time]~[end-time]' [SDS archive] > [file.mseed]
.. note::
Sorting data is computational expensive but required for waveform playbacks.
#. Push miniSEED data from file :file:`file.mseed` into a local :term:`SDS`
archive. Additionally, you may check if the records of the created files are
correctly ordered:
.. code-block:: sh
scart -I [file.mseed] [SDS archive]
scart -I [file.mseed] --with-filecheck [SDS archive]
#. Collect data from an FDSNWS server using the :ref:`global_recordstream`
interface and write to a miniSEED file. The data streams and the time spans are
defined in a list file using the option ``list``. The list can be generated e.g.
by :ref:`scevtstreams`.
.. code-block:: sh
scart -I fdsnws://[server]:80 --list list.file --stdout > file.mseed
#. Check all files of an SDS archive or other directory structure for
miniSEED files with out-of-order records:
.. code-block:: sh
scart --check [archive]
#. Print stream information from miniSEED files in archives or from
:term:`RecordStream` without actually writing miniSEED data:
.. code-block:: sh
scart -I [miniSEED file] --print-streams
scart -d -t [time span] [SDS archive] --print-streams
scart --check [archive] --print-streams
The output looks like this:
.. code-block:: sh
# streamID start end records samples samplingRate
GE.RGN..BHZ 2022-12-08T15:34:41.895Z 2022-12-08T15:52:19.145Z 58 21145 20.0
where the header and the text body are printed to stdout.
Command-Line Options
====================
.. program:: scart
:program:`scart [options] {archive-dir}`
The last option has to be the archive directory when dump mode is enabled.
When no archive directory is explicitly given,
\$SEISCOMP_ROOT\/var\/lib\/archive or the current directory
is used depending on whether \$SEISCOMP_ROOT has been set or not.
The default operation mode is import. That means that a multiplexed
MiniSEED file or another record source such as ArcLink is used to import
records into a SDS structure.
Verbosity
---------
.. option:: -v, --verbose
Verbose mode.
.. option:: -h, --help
Display a help message.
Mode
----
.. option:: --check
Check mode. Check all files
in the given directory for erroneous miniSEED records.
All sub\-directories are included.
If no directory is given, the default SDS archive is scanned.
.. option:: -d, --dump
Set export \(dump\) mode. Records are retrieved from an archive and
written to standard output.
.. option:: -I
Import mode: Specify the recordstream URL when in import mode.
When using another recordstream than a file \(like ArcLink\) a stream
list file is required. Default: file:\/\/\- \(stdin\).
Output
------
.. option:: -c channels
Specify the channel filter for the dumped streams as regular
expression. Default: \(B\|S\|M\|H\)\(L\|H\)\(Z\|N\|E\). To dump only
BHZ, BHN and BHE streams use BH\(Z\|N\|E\).
.. option:: -E
Sort records according to their end time. Default: start time.
.. option:: --files count
Specify the number of file handles to cache. Default: 100.
.. option:: -l, --list file
Uses a stream list file instead of defined networks and channels
\(\-n and \-c are ignored\). The list can be generated from events
by scevetstreams. One line per stream.
Line format: starttime;endtime;streamID.
The time format is the same as described in option '\-t'.
Example:
2019\-07\-17 02:00:00;2019\-07\-17 02:10:00;GR.CLL..BH?
.. option:: --nslc file
Uses a stream list file instead of defined networks and
channels \(\-n and \-c are ignored\). In dump mode only. The
time window must be provided separately. Wild cards may be
used. The list can be generated from bindings by scdumpcfg
or from inventory by scinv. Use one line per stream. Line
format: NET.STA.LOC.CHA.
Example:
GR.CLL..BH?
.. option:: -m, --modify
Modify the record time for real time playback when in export mode.
The first record time is NOW. The relative time of successive records
to the first one are kept.
.. option:: -n networks
List of network codes to dump \(comma separated\). Default: \*.
.. option:: -s, --sort
Sort records by [start\-]time. To sort records by their endtime use \-E.
.. option:: --speed
Specify the speed to dump the records. A value of 0 means no delay
otherwise speed is a multiplier of the real time difference between
the records. When feeding the records directly into the replay pipe
a value of 1 \(real time\) is recommended.
.. option:: --stdout
Write to stdout if import mode is used instead of creating a
SDS archive.
.. option:: --print-streams
Print stream information only and exit. Works in import, dump
and check mode. Output: NET.STA.LOC.CHA StartTime EndTime.
.. option:: --test
Test only, no record output. This switch is useful
for debugging.
.. option:: -t timeWindow
Specify the time window \(as one properly quoted string\) to dump
records for. Times are UTC and separated by a tilde \"\~\".
To dump one hour of waveform data between 2008\/01\/01 00:00:00 and
2008\/01\/01 01:00:00 use
<\-t \"2008\-01\-01 00:00:00\~2008\-01\-01 01:00:00\">.
.. option:: --with-filecheck
Check all accessed files after import. Unsorted or
unreadable files are reported to stderr.
.. option:: --with-filename
Print all accessed files to stdout after import.