invextr

Extract and clean or remove streams from inventory.

Description

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

  • Extract or remove networks, stations, sensor locations and channels based on

    • stream IDs,

    • geographic region,

    • time.

  • Clean inventories from unreferenced objects such as data loggers, sensors or instrument responses when extracting.

    Note

    Cleaning inventory may also be achieved by merging inventories with scinv.

The important parameters are:

  • Stream ID list (--chans, --nslc). Without a stream ID, only unreferenced objects are removed when extracting.

  • Input file or stdin

  • Output file (--output) or stdout

  • Region bounding box (--region, optional)

where the output XML 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 stream ID is a simple string that is matched against the final stream ID in the inventory. This final stream 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 with one sensor locations 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
  • Just clean inventory from unreferenced objects such as data loggers, sensors or instrument responses.

    invextr inventory.xml -o inventory-cleaned.xml
    
  • The IDs are matched against streams passed with --chans:

    invextr --chans "GE*" inventory.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 inventory.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*" inventory.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" inventory.xml
    
  • To extract all vertical components, use:

    invextr --chans "*Z" inventory.xml
    
  • To extract BHN and LHZ, use:

    invextr --chans "*BHN,*LHZ" inventory.xml
    
  • To remove all HH and SH channels, use:

    invextr --rm --chans "*HH?,*SH?" inventory.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 streams to extract or remove (--rm) which can contain wildcards. Avoiding confusion with files names due to SHELL extension requires to enclose stream codes by quotes. Default: *.*.*.* meaning all streams. Unreferenced sensors, data loggers and resonses are removed when extracting. A comma separated list of channel IDs to extract which may contain wildcards. Default: *.*.*.* meaning all streams.

Example: invextr --chans "GE.*.*.BHZ,GE.MORC.*.*" inventory.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

Output

-f, --formatted

Enable formatted XML output.

-o, --output

Name of output file. If not given or ‘-’, output is sent to stdout.