# invextr — SeisComP Release documentation

6.9.0

# invextr

Extract channels from inventory.

## Description

invextr reads and modifies inventory XML provided as file or on stdin:

- Extract or remove networks, stations and channels based on

  - channel IDs

  - geographic region

  - time

- Clean inventories from unused objects such as data loggers, sensors or instrument responses.

The important parameters are:

- Channel ID list (required)

- Input file or stdin

- Output file or stdout

- Region bounding box (optional)

whereas the output file defaults to stdout and the input file to stdin if not given.

The optional region box will be used to filter the read inventory based on the coordinates of sensor locations. Only stations with sensor locations within the region will be considered. All others will be ignored.

A channel ID is a simple string that is matched against the final channel ID in the inventory. This final channel ID is constructed by joining the codes of all stages with a dot where the stages are network, station, location and channel.

The content of the resulting inventory may be listed using scinv.

### Examples

Suppose an inventory with network GE, a station MORC and several channels:

    network GE
      station MORC
        location __
          channel BHZ    ID: GE.MORC..BHZ
          channel BHN    ID: GE.MORC..BHN
          channel BHE    ID: GE.MORC..BHE
          channel LHZ    ID: GE.MORC..LHZ
          channel LHN    ID: GE.MORC..LHN
          channel LHE    ID: GE.MORC..LHE

- The IDs are matched against streams passed with –chans.

      invextr --chans "GE*" inv.xml

  All streams are passed and nothing is filtered because GE* matches all available IDs and region filter is not used. Since `inv.xml` only contains stations from the GE network the option `--chans` is not useful here at all.

        invextr -r 0,-180,90,180 inv.xml

      All streams located in the northern hemisphere are passed as commanded by the
      region bounding box.

- Nothing is filtered again because MORC matches all available IDs.

      invextr --chans "*MORC*" inv.xml

- Everything is filtered because GE.MORC does not match with any ID. To make it work, an asterisk needs to be appended: GE.MORC* or GE.MORC.*.

      invextr --chans "GE.MORC" inv.xml

- To extract all vertical components, use:

      invextr --chans "*Z" inv.xml

- To extract BHN and LHZ, use:

    invextr --chans "*BHN,*LHZ" inv.xml

- To remove all HH and SH channels, use:

      invextr --rm --chans "*HH?,*SH?" inv.xml

## Module Configuration

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

invextr inherits global options.

## Command-Line Options

invextr [OPTIONS] [input=stdin] [output=stdout]

### Generic

-h, --help

  Show help message.

-V, --version

  Show version information.

--config-file arg

  Use alternative configuration file. When this option is used the loading of all stages is disabled. Only the given configuration file is parsed and used. To use another name for the configuration create a symbolic link of the application or copy it. Example: scautopick -> scautopick2.

--plugins arg

  Load given plugins.

-D, --daemon

  Run as daemon. This means the application will fork itself and doesn’t need to be started with &.

### 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.

--print-component arg

  For each log entry print the component right after the log level. By default the component output is enabled for file output but disabled for console output.

--trace

  Execute in trace mode. Equivalent to --verbosity=4 --console=1 --print-component=1 --print-context=1 .

### Extract

--begin arg

  Begin time to consider streams. Streams ending at or before that time will be ignored.

--end arg

  End time to consider streams. Streams starting after that time will be ignored.

--chans arg

  A comma separated list of channel IDs to extract which can contain wildcards. Default: *.*.*.* meaning all streams.

  Example: invextr --chans "GE.*.*.BHZ,GE.MORC.*.*" inv.xml

--nslc arg

  Stream list file to be used for extracting inventory. Wildcards can be used. --chans is ignored.

-r, --region arg

  Filter streams by geographic region given as "South, East, North, West". Region is unused by default.

--rm arg

  Removes all channels given with ‘--chans’ instead of extracting them.

  Example: invextr --rm --chans "GE.*" inv.xml

-f, --formatted

  Enables formatted XML output.