tabinvmodifier

[Nov. 2016: Has been added to SC3 documentation - remove here with next SC3 documentation release]

Sometimes small tweaks need to be made to inventory.

The tabinvmodifier program reads a rules file (a network tab file without any station lines) and applies network and station attributes to existing inventory. This method can be used to modify attributes in inventory that originate from dataless SEED or other sources. It can change inventory at all four levels: network, station, location, and channel; it can also change sensor and datalogger attributes (Ia lines). Currently (in 2016) changes to station groups (virtual networks) aren't supported.

For details of what can go in a tab file, see NETTAB File Format Description.

tabinvmodifier can either write directly to the inventory in an SC3 database, or dump output as an XML file.

Examples

1. As an example, suppose we create file ge.rules containing

Nw: GE 1993/001
Na: Description="GEOFON Program, GFZ Potsdam, Germany"
Na: Remark="Access to Libyan stations and Spanish HH streams limited"
Na: Type=VBB

The first line (Nw:) specifies the network, including its start date, that these rules will be applied to. The following lines starting with Na: provide values for the description, remark, and type attributes to be written into the new inventory.

We can use this rules file to change attributes of the GE network:

# Apply changes to database directly
$ tabinvmodifier -r ge.rules

# Apply changes to XML file
$ tabinvmodifier -r ge.rules --inventory-db ge.xml -o ge-mod.xml

The resulting inventory now contains:

    <network publicID="Network#20130513163612.389203.2" code="GE">
      <start>1993-01-01T00:00:00.0000Z</start>
      <description>GEOFON Program, GFZ Potsdam, Germany</description>
      <institutions>GFZ/partners</institutions>
      <region>euromed global</region>
      <type>VBB</type>
      <netClass>p</netClass>
      <archive>GFZ</archive>
      <restricted>false</restricted>
      <shared>true</shared>
      <remark>access to Libyan stations and Spanish HH streams limited</remark>
      <station publicID="Station#20130620185450.488952.190" code="MSBI" archiveN
etworkCode="GE">
        <start>2013-06-16T00:00:00.0000Z</start>

Other attributes present in inventory are left unchanged.

If output was as an XML file, typically this should then be moved to ~/seiscomp3/etc/inventory, and then loaded into the database with seiscomp update-config.


2. It is even possible to use tabinvmodifer to change location codes. (Thanks to Andres H. for this example.) For example, suppose we want to replace an empty location code for station "KP.UPNV" with location code "00", together with its description and place. Then our rules file is:

Nw: KP 1980/001

Sa: Affiliation="GLISN" *
Sa: Country="Greenland" *
Sa: Description="GLISN Station Upernavik, Greenland" UPNV
Sa: Place="Upernavik, Greenland" UPNV

Sa: Code="00" UPNV, 

The resulting inventory now contains:

    <network publicID="Network#20140603153203.17936.2" code="KP">
      <start>1980-01-01T00:00:00.0000Z</start>
      ...
      <station publicID="Station#20140603153203.179738.3" code="UPNV">
        <start>2013-08-01T00:00:00.0000Z</start>
        <description>GLISN Station Upernavik, Greenland</description>
        <latitude>72.7829</latitude>
        <longitude>-56.1395</longitude>
        <elevation>38</elevation>
        <place>Upernavik, Greenland</place>
        <affiliation>GLISN</affiliation>
        ...
        <sensorLocation publicID="SensorLocation#20140603153203.181119.4" code="00">
          <start>2013-08-01T00:00:00.0000Z</start>

Command line options

[Needs reformatting]

* "rules,r", "Input XML filename of the rules file"

* "relaxed,e", "Relax rules for matching NSLC items"

* "Dump", "output,o", "Output XML filename"