7.0.0

# scqueryqc

Query waveform quality control (QC) parameters from database.

## Description

scqueryqc queries a database for waveform quality control (QC) parameters. The QC parameters can be provided and written to the database, e.g., by scqc.

Warning

Writing QC parameters to the database by scqc will result in a rapidly growing database and is therefore not recommended in permanent application without regularly stripping these parameters from the database!

The database query is done for

- One or multiple streams,

- One or multiple QC parameters. All QC parameters can be requested. Defaults apply. For reading the defaults use

      scqueryqc -h

- A single time window where the begin time must be provided. Current time is considered if the end is not give.

### Workflow

You should minimize the impact of stored waveform QC parameters on the size of the database.

1. Compute the QC parameters in real time using scqc and save them in the SeisComP database. Saving the QC parameters in the database requires to adjust the scqc module configuration parameters `plugins.$name.archive.interval` for each plugin.

2. Regularly use scqueryqc for some time span to read the QC parameters from the database. Save them in a XML files.

   Example for all QC parameters found for all streams in the inventory before end time:

       scqueryqc -d [host] -e '[end time]' --streams-from-inventory -o [XML file]

3. Clean the database from QC parameters.

   - Either use scdispatch with the parameters saved in XML. You may need to set the routing table for sending the QualityControl parameters to the right message group, e.g., QC:

         scdispatch -H [host] -O remove --routingtable QualityControl:QC -i [XML file]

   - Alternatively, use scdbstrip with the command-line option `--qc-only` and remove all QC parameters in the time span. Use the same period for which the QC parameters were retrieved:

         scdbstrip -d [database] -Q --date-time '[end time]'

     Note

     Considering an end time by `--date-time` has the advantage that no QC parameters are removed which were measured after scqueryqc was applied with the same end time value.

### Examples

- Query rms and delay values for the stream AU.AS18..SHZ,AU.AS19..SHZ before ‘2021-11-20 00:00:00’. Write the XML to stdout

      scqueryqc -d localhost -e '2021-11-20 00:00:00' -p rms,delay -i AU.AS18..SHZ,AU.AS19..SHZ

- Query all default QC parameter values for all streams found in the inventory from ‘2021-11-20 00:00:00’ until current. Write the formatted XML output to `/tmp/query.xml`

      scqueryqc -d localhost -b '2021-11-20 00:00:00' --streams-from-inventory -f -o /tmp/query.xml

## Module Configuration

`etc/defaults/global.cfg`
`etc/defaults/scqueryqc.cfg`
`etc/global.cfg`
`etc/scqueryqc.cfg`
`~/.seiscomp/global.cfg`
`~/.seiscomp/scqueryqc.cfg`

scqueryqc inherits global options.

## Command-Line Options

scqueryqc [options]

### Generic

-h, --help

  Show help message.

-V, --version

  Show version information.

### Verbosity

--verbosity arg

  Verbosity level [0..4]. 0:quiet, 1:error, 2:warning, 3:info, 4:debug.

-v, --v

  Increase verbosity level (may be repeated, eg. -vv).

-q, --quiet

  Quiet mode: no logging output.

--component arg

  Limit the logging to a certain component. This option can be given more than once.

-s, --syslog

  Use syslog logging backend. The output usually goes to /var/lib/messages.

-l, --lockfile arg

  Path to lock file.

--console arg

  Send log output to stdout.

--debug

  Execute in debug mode. Equivalent to --verbosity=4 --console=1 .

--log-file arg

  Use alternative log file.

### Database

--db-driver-list

  List all supported database drivers.

-d, --database arg

  The database connection string, format: service://user:pwd@host/database. "service" is the name of the database driver which can be queried with "--db-driver-list".

--inventory-db arg

  Load the inventory from the given database or file, format: [service://]location .

### Output

-o, --output filename

  Name of output XML file. Objects are sent to stderr if none is given.

-f, --formatted

  Write formatted XML.

### Query

-b, --begin time

  Begin time of query. Format: ‘YYYY-MM-DD hh:mm:ss’. ‘1900-01-01T00:00:00Z’ is considered if undefined.

-e, --end time

  End time of query. Format: ‘YYYY-MM-DD hh:mm:ss’. Current time is considered if undefined.

-i, --stream-id string

  Waveform stream ID to search for QC parameters: net.sta.loc.cha - [networkCode].[stationCode].[sensorLocationCode].[channelCode]. Provide a single ID or a comma-separated list. Overrides ‘--streams-from-inventory’.

-p, --parameter string

  QC parameter to output: (e.g. delay,rms,’gaps count’ …). Use quotes if QC parameter has more than 1 word. Provide a single parameter or a comma-separated list. Defaults are used if parameter is undefined.

--streams-from-inventory

  Read streams from inventory. Superseded by ‘--stream-id’.