Skip to main content

IRIS-validator

iris-validator is a small python module for validation stationxml files against the IRIS StationXML Validation Rules found at:

https://github.com/iris-edu/stationxml-validator/wiki/StationXML-Validation-Rule-List

It has a limited API and a command-line script

Installation

Requirements

obspy >= 1.2

These requirements should be automatically installed for you (see below).

Install

Easy install from pypi:

>pip install iris-validator

Alternatively, you can Clone the repository and install:

>git clone https@gitlab.isti.com:mhagerty/iris-validator.git 
>cd iris-validator
>pip install .

Usage:

Once you have installed it, you should be able to run it as a python module from any directory.

iris-validator can either test your own xml against the iris validation rules (--infile /path/to/your.xml) or it can run through a suite of tests that test known xml snippets against each rule (--run-tests). The tests are mainly there to confirm that the iris rules are being applied correctly (e.g., to test the code itself).

>iris-validator

usage: iris-validator [-h] (--infile INFILE | --run-tests)

required arguments: // One of these is required
  --infile INFILE       // path-to StationXML file, e.g., --infile=/path/to/foo.xml
  --run-tests           // Run IRIS Validator Test Files

> iris-validator --run-tests
Check file:F1_101.xml against Rule:101
SUCCESS: xmlfile=[F1_101.xml] FAILED as expected
Check file:F1_110.xml against Rule:110
SUCCESS: xmlfile=[F1_110.xml] FAILED as expected
Check file:F2_110.xml against Rule:110 
SUCCESS: xmlfile=[F2_110.xml] FAILED as expected
...
Check file:P1_112.xml against Rule:112
SUCCESS: xmlfile=[P1_112.xml] PASSED as expected
...
Check file:F1_422.xml against Rule:422 
SUCCESS: xmlfile=[F1_422.xml] FAILED as expected
Check file:F1_423.xml against Rule:423
SUCCESS: xmlfile=[F1_423.xml] FAILED as expected

Additional cmd line options:

usage: iris-validator [-h] (--infile INFILE | --run-tests)
       [-s STATION] [-c CHANNEL] [-n NETWORK] [-l LOCATION] [-def] [-i IGNORE [IGNORE ...]]

options:
  -h, --help            show this help message and exit
  -s STATION, --station STATION, --sta STATION
                        Specify a station code, wildcards are allowed
  -c CHANNEL, --channel CHANNEL, --cha CHANNEL
                        Specify a channel code, wildcards are allowed
  -n NETWORK, --network NETWORK, --net NETWORK
                        Specify a network code, wildcards are allowed
  -l LOCATION, --location LOCATION, --loc LOCATION
                        Specify a location code, wildcards are allowed
  -def, --seismic-only, --seismic_only
                        Only scan default_seismic_channels in: {[BEHSG][HNL][123ENZ]}
  -i IGNORE [IGNORE ...], --ignore IGNORE [IGNORE ...]
                        Specify list of rule codes to ignore

For example, to ignore specific rule checks you can do:

  >iris-validator --infile /path/to/file.xml -i 321,420 421 422 ...

-n, -s, -c, -l flags can be used to select only these channels for scanning

API

To use the module from within your own python script, follow the example below:

from iris_validator import stationxml_validator

validator = stationxml_validator('path/to/some/stationxml.xml')

validator.validate_inventory()

print("[ERRORS]:\n")
for msgs in validator.errors:
    for i, msg in enumerate(msgs):
        if i == 0:
            print(msg)
        else:
            print("%7s %s" % (' ', msg))

print("\n[WARNINGS]:\n")
for msgs in validator.warnings:
    for i, msg in enumerate(msgs):
        if i == 0:
            print(msg)
        else:
            print("%7s %s" % (' ', msg))

Note some other things you can do include:

validator.validate_rule('420')          // You can test your stationxml file against one rule at a time

Metadata

Release files for iris-validator 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iris-validator 0.0.3
File Size Uploaded Provenance Actions
iris-validator-0.0.3.tar.gz 537.9 kB Without provenance Details for iris-validator-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iris-validator 0.0.3
File Interpreter ABI Platform Actions
iris_validator-0.0.3-py2.py3-none-any.whl Python 3, Python 2 none any Details for iris_validator-0.0.3-py2.py3-none-any.whl

Total release size: 1.2 MB

Release files / iris-validator-0.0.3.tar.gz

Download URL iris-validator-0.0.3.tar.gz
Size 537.9 kB
Tags Source
SHA-256 checksum
How to use checksums
82f85b7cb2db4a4d7a3777c1055f8791062b2964c2dbe93140b5bf4c17fd184c
BLAKE2b-256 checksum
How to use checksums
fa00805b04e154901e5b1dd2324c6d9293ecdec9a7e6ade973de4bb496360375
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / iris_validator-0.0.3-py2.py3-none-any.whl

Download URL iris_validator-0.0.3-py2.py3-none-any.whl
Size 686.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
509126270bd2203266930d130e0d75d3dd6b3c0bd29c00a4a194d67c80d1c2c5
BLAKE2b-256 checksum
How to use checksums
4a3d13a33fb849e052ad0698c4bc7b11e15bf90554915cc7fd6862a9fd461138
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Security for iris-validator 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page