invextr

Extract channels from inventory.

Description

invextr extracts or removes networks, stations and channels from an inventory XML file. It takes basically three important parameters:

  1. channel ID list

  2. input file

  3. output file

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

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.

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 what is passed with –chans.

invextr --chans "GE*" inv.xml

Nothing is filtered because GE* matches all available IDs.

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

Nothing is filtered again because MORC matches all available IDs.

invextr --chans "GE.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.*.

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

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

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, eg 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

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

-s, --syslog

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

-l, --lockfile arg

Path to lock file.

--console arg

Send log output to stdout.

--debug

Debug mode: –verbosity=4 –console=1

--log-file arg

Use alternative log file.

Extract

--chans arg

A comma separated list of channel ids to extract which can contain wildcards.

Example: invextr –chans “GE.*.*.BHZ,GE.MORC.*.*” inv.xml

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