Skip to content
Tobias Megies edited this page Nov 12, 2020 · 24 revisions

Description

ObsPyck is a GUI application that is intended to cover the tasks in a standard analysis workflow for seismic events in seismological observatory practice. To achieve this ObsPyck heavily relies on several ObsPy modules.

Data Retrieval

ObsPyck can connect to different servers (FDSNWS, ArcLink, Seedlink, SeisHub, local SDS directory tree), automatically fetches waveforms and metadata (instrument responses, station coordinates) for given time span and network/station IDs and shows all fetched data in a fully interactive screen. Waveform data can also be visualized in form of spectrograms. There is also support for local files (all file formats recognized by ObsPy, metadata has to be supplied in either StationXML or Dataless SEED/XSEED).

Data Analysis

ObsPyck can then be used to set P and S wave picks (or custom defined phases) as well as set amplitude maxima/minima for magnitude estimation. These pick data can then be used to run various external programs (e.g. Hypo Inverse 2000, NLLoc, FocMec) that are addressed via system calls. Local magnitudes are calculated using ObsPy (including instrument corrections with fetched response information). The resulting event location and additional information is displayed together with station magnitudes and locations and in an interactive map.

Upload/Storage of Results

Finally the event results can be saved locally to a QuakeML file and also uploaded if connected to a SeisHub or Jane server.

Installation

ObsPyck has been ported to Python 3 and Qt 5 with version 0.8.0. Main functionality has been tested but some less frequently used code in subroutines might still fail after the port. Please open an issue on GitHub if you run into problems.

Recommended installation is via Anaconda. Install Anaconda first, following their instructions (only needed if you do not have an Anaconda installation already, of course). Then add the conda-forge channel and install obspyck. Using a dedicated environment specifically for obspy is strongly recommended:

$ conda config --add channels conda-forge
# pyproj only needed if nonlinloc coordinates have to be converted to lat/lon manually
$ conda create -n obspyck python=3 'obspyck>=0.8' pyproj
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /home/megies/anaconda2/envs/obspyck-py3qt5

  added / updated specs:
    - flake8
    - obspyck[version='>=0.8']
    - pip
    - pyproj
    - python=3


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    matplotlib-3.3.3           |   py38h578d9bd_0           6 KB  conda-forge
    matplotlib-base-3.3.3      |   py38h5c7f4ab_0         6.7 MB  conda-forge
    obspyck-0.8.0              |     pyhd8ed1ab_0          82 KB  conda-forge
    ------------------------------------------------------------
                                           Total:         6.8 MB

The following NEW packages will be INSTALLED:

  _libgcc_mutex      conda-forge/linux-64::_libgcc_mutex-0.1-conda_forge
  _openmp_mutex      conda-forge/linux-64::_openmp_mutex-4.5-1_gnu
[...]
  matplotlib         conda-forge/linux-64::matplotlib-3.3.3-py38h578d9bd_0
  matplotlib-base    conda-forge/linux-64::matplotlib-base-3.3.3-py38h5c7f4ab_0
  mccabe             conda-forge/noarch::mccabe-0.6.1-py_1
  mysql-common       conda-forge/linux-64::mysql-common-8.0.21-2
  mysql-libs         conda-forge/linux-64::mysql-libs-8.0.21-hf3661c5_2
  ncurses            conda-forge/linux-64::ncurses-6.2-h58526e2_3
  nspr               conda-forge/linux-64::nspr-4.29-he1b5a44_1
  nss                conda-forge/linux-64::nss-3.58-h27285de_1
  numpy              conda-forge/linux-64::numpy-1.19.4-py38hf0fd68c_1
  obspy              conda-forge/linux-64::obspy-1.2.2-py38h8790de6_0
  obspyck            conda-forge/noarch::obspyck-0.8.0-pyhd8ed1ab_0
[...]
  pyproj             conda-forge/linux-64::pyproj-3.0.0.post1-py38h8df5ac0_0
  pyqt               conda-forge/linux-64::pyqt-5.12.3-py38ha8c2ead_4
  pysocks            conda-forge/linux-64::pysocks-1.7.1-py38h924ce5b_2
  python             conda-forge/linux-64::python-3.8.6-h852b56e_0_cpython
  python-dateutil    conda-forge/noarch::python-dateutil-2.8.1-py_0
  python_abi         conda-forge/linux-64::python_abi-3.8-1_cp38
  qt                 conda-forge/linux-64::qt-5.12.9-h1f2b2cb_0
[...]


Proceed ([y]/n)? 


Downloading and Extracting Packages
matplotlib-base-3.3. | 6.7 MB    | ##################################################################################################################################### | 100% 
matplotlib-3.3.3     | 6 KB      | ##################################################################################################################################### | 100% 
obspyck-0.8.0        | 82 KB     | ##################################################################################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate obspyck-py3qt5
#
# To deactivate an active environment, use
#
#     $ conda deactivate

(base) $ conda activate obspyck-py3qt5
(obspyck-py3qt5) $ obspyck -h

Alternatively, releases are also available on pypi and can be installed using pip.

Running obspyck

To run obspyck, simply activate that environment you created earlier and run obspyck:

$ conda activate obspyck
(obspyck) $ obspyck -h
Usage: 
 obspyck -t 2010-08-01T12:00:00 -d 30 [local waveform or station metadata files]

[...]

An example with US Transportable Array stations and the 2011 Oklahoma M 5.7 earthquake can be run like this (assuming a recent ObsPy installation which sets up the ~/.obspyckrc file with the EXAMPLE station combination, see here and here):

(obspyck) $ obspyck -s EXAMPLE -d 300 -o -10 -t 2011-11-06T03:53:10

More generally, command line options at time of writing are:

(obspyck) $ obspyck -t <starttime> [-config <config file>] [-s <station combinations>] [-d <time length of window>] [local waveform/station metadata files (e.g. StationXML)]

Notes:

  • obspyck -h displays usage details
  • Waveform files are a space-delimited set of filenames and paths. These files can be any Obspy-readable format – e.g. SAC, miniSEED, GCF. Can also be a single multiplexed miniSEED file.
  • Station metadata can be specified as StationXML and/or Dataless SEED files containing metadata for stations to be analysed needs to be provided so station locations can be determined (and instrument response correction, if required). Only needed for local waveform files. When fetching data from servers / data centers, metadata are automatically fetched together with the waveforms.
  • Time start in the typical obspy UTCDateTime object format: yyyy-mm-ddThh:mm:ss
  • -d in seconds (optional). Default is defined in the config file.
  • Config file: path and filename. Example is given in the Obspyck installation directory Obspyck/Obspyck/example.cfg. By default uses ~/.obspyckrc which gets created from example config if not already present.

Problems with Installation via Anaconda

Sometimes there are broken packages available in anaconda, the following combination of package versions was working at the time of writing (November 2018) for obspyck 0.5.1:

$ conda create -n obspyck_test python=2.7 obspyck=0.5.1 matplotlib=2.0.0 qt=4.8.7 lxml=3.8.0
Solving environment: done

## Package Plan ##

  environment location: /home/megies/anaconda/envs/obspyck_test

  added / updated specs: 
    - lxml=3.8.0
    - matplotlib=2.0.0
    - obspyck=0.5.1
    - python=2.7
    - qt=4.8.7


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    matplotlib-2.0.0           |      np112py27_2         9.2 MB  conda-forge
    graphite2-1.3.12           |       hfc679d8_1         104 KB  conda-forge
    lxml-3.8.0                 |           py27_0         3.3 MB  conda-forge
    ------------------------------------------------------------
                                           Total:        12.7 MB

The following NEW packages will be INSTALLED:

    asn1crypto:           0.24.0-py27_1003      conda-forge
    backports_abc:        0.5-py_1              conda-forge
    blas:                 1.0-mkl                          
    ca-certificates:      2018.10.15-ha4d7672_0 conda-forge
    cairo:                1.14.6-4              conda-forge
    certifi:              2018.10.15-py27_1000  conda-forge
    cffi:                 1.11.5-py27h5e8e0c9_1 conda-forge
    chardet:              3.0.4-py27_1003       conda-forge
    cryptography:         2.3.1-py27hdffb7b8_0  conda-forge
    cryptography-vectors: 2.3.1-py27_1000       conda-forge
    cycler:               0.10.0-py_1           conda-forge
    decorator:            4.3.0-py_0            conda-forge
    enum34:               1.1.6-py27_1001       conda-forge
    fontconfig:           2.12.1-4              conda-forge
    freetype:             2.7-1                 conda-forge
    funcsigs:             1.0.2-py_2            conda-forge
    functools32:          3.2.3.2-py_3          conda-forge
    future:               0.17.0-py27_1000      conda-forge
    futures:              3.2.0-py27_1000       conda-forge
    gettext:              0.19.8.1-h5e8e0c9_1   conda-forge
    glib:                 2.51.4-0              conda-forge
    graphite2:            1.3.12-hfc679d8_1     conda-forge
    harfbuzz:             1.4.3-0               conda-forge
    icu:                  58.2-hfc679d8_0       conda-forge
    idna:                 2.7-py27_1002         conda-forge
    intel-openmp:         2019.0-118                       
    ipaddress:            1.0.22-py_1           conda-forge
    jpeg:                 9c-h470a237_1         conda-forge
    libffi:               3.2.1-hfc679d8_5      conda-forge
    libgcc-ng:            7.2.0-hdf63c60_3      conda-forge
    libgfortran-ng:       7.2.0-hdf63c60_3      conda-forge
    libiconv:             1.15-h470a237_3       conda-forge
    libpng:               1.6.35-ha92aebf_2     conda-forge
    libstdcxx-ng:         7.2.0-hdf63c60_3      conda-forge
    libtiff:              4.0.9-he6b73bb_2      conda-forge
    libxml2:              2.9.8-h422b904_5      conda-forge
    libxslt:              1.1.32-h88dbc4e_2     conda-forge
    lxml:                 3.8.0-py27_0          conda-forge
    matplotlib:           2.0.0-np112py27_2     conda-forge
    mkl:                  2019.0-118                       
    mock:                 2.0.0-py27_1000       conda-forge
    ncurses:              5.9-10                conda-forge
    numpy:                1.12.1-py27h9378851_1            
    obspy:                1.1.0-py27h39e3cac_2  conda-forge
    obspyck:              0.5.1-py27_0          conda-forge
    openssl:              1.0.2p-h470a237_1     conda-forge
    pango:                1.40.4-0              conda-forge
    pbr:                  4.2.0-py_0            conda-forge
    pcre:                 8.41-hfc679d8_3       conda-forge
    pip:                  18.1-py27_1000        conda-forge
    pixman:               0.34.0-h470a237_3     conda-forge
    pycparser:            2.19-py_0             conda-forge
    pyopenssl:            18.0.0-py27_1000      conda-forge
    pyparsing:            2.3.0-py_0            conda-forge
    pyqt:                 4.11.4-py27_3         conda-forge
    pysocks:              1.6.8-py27_1002       conda-forge
    python:               2.7.14-2              conda-forge
    python-dateutil:      2.7.5-py_0            conda-forge
    pytz:                 2018.7-py_0           conda-forge
    qt:                   4.8.7-7               conda-forge
    readline:             6.2-0                 conda-forge
    requests:             2.20.0-py27_1000      conda-forge
    scipy:                1.1.0-py27hc49cb51_0             
    setuptools:           40.5.0-py27_0         conda-forge
    singledispatch:       3.4.0.3-py27_1000     conda-forge
    sip:                  4.18-py27_1           conda-forge
    six:                  1.11.0-py27_1001      conda-forge
    sqlalchemy:           1.2.13-py27h470a237_0 conda-forge
    sqlite:               3.13.0-1              conda-forge
    subprocess32:         3.5.3-py27h470a237_0  conda-forge
    tk:                   8.5.19-2              conda-forge
    tornado:              5.1.1-py27h470a237_0  conda-forge
    urllib3:              1.23-py27_1001        conda-forge
    wheel:                0.32.2-py27_0         conda-forge
    xz:                   5.2.4-h470a237_1      conda-forge
    zlib:                 1.2.11-h470a237_3     conda-forge

Proceed ([y]/n)? 


Downloading and Extracting Packages
matplotlib-2.0.0     | 9.2 MB    | ####################################################################################### | 100% 
graphite2-1.3.12     | 104 KB    | ####################################################################################### | 100% 
lxml-3.8.0           | 3.3 MB    | ####################################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate obspyck_test
#
# To deactivate an active environment, use
#
#     $ conda deactivate

Integrating with Hypoinverse (hypo2000)

  • Need to make a directory for location of Obspyck plugins (e.g. Hypoinverse, Nonlinloc, Focmec) - directory name is defined in the .cfg file – ‘pluginpath’
  • In the plug-in directory, you need the following: crustal velocity model (e.g. .crh); HypoInverse control file (e.g. .inp); hypoInverse binary executable file (see below)
  • Binary executable: source code available from ftp://ehzftp.wr.usgs.gov/klein/hyp1.40/; pre-compiled Linux version from http://faldersons.net/Software/Hypoinverse/Hypoinverse.html; Linux binary should be named “hyp2000__Linux__64bit” for Linux 64-bit or “hyp2000__Darwin__64bit” for Mac OSX
  • Hypoinverse working files are stored in temp directory determined by Python (normally /var/)

Screenshots

Warning: Unfortunately, screenshots might be outdated..

Clicking 'Overview' plots the Z trace of every stream. https://raw.github.com/megies/misc/master/images/obspyck_overview.png

After zooming in using the mouse wheel (shift + mouse wheel to zoom amplitude) picks can be set using the mouse buttons (or at the mouse position with user-defined keys). https://raw.github.com/megies/misc/master/images/obspyck_picking.png

After setting all picks the external location algorithm can be run e.g. by clicking 'do NLLoc'. The event location and information on residuals and magnitudes are displayed in an interactively zoomable map. https://raw.github.com/megies/misc/master/images/obspyck_map.png

After locating, the synthetic picks from the residuals are shown in the stream view. This enables convenient refining of picks. https://raw.github.com/megies/misc/master/images/obspyck_refine.png

Waveform data can also be visualized in form of spectrograms. https://raw.github.com/megies/misc/master/images/obspyck_spectrogram.png

Focal mechanisms determined by FocMec can be visualized indicating alternative solutions. https://raw.github.com/megies/misc/master/images/obspyck_focmec.png

A Wadati diagram can be plotted to estimate local Vp/Vs ratios. https://raw.github.com/megies/misc/master/images/obspyck_wadati.png

At the moment ObsPyck is tested on Linux and Mac. https://raw.github.com/megies/misc/master/images/obspyck_startup.png

The debugging mode allows access to all internal variables and data. https://raw.github.com/megies/misc/master/images/obspyck_debug.png

Dependencies

Necessary

Recommended