Skip to content

Noise Toolkit Polarization Attributes bundle V.1

Manoch Bahavar edited this page Nov 12, 2020 · 2 revisions

DESCRIPTION (V.1.0):

The IRIS DMC Noise Toolkit Polarization Attributes (POLAR) bundle is a collection of 3 Python scripts that are configurable and allow users to conveniently calculate and extract polarization attributes of 3-C seismic data. Although this package takes advantage of the FDSN Web service client for ObsPy to retrieve necessary waveform data, but it also allows users to process waveform data from their local files. This bundle is a standalone bundle that directly computes the spectra of the input waveform data in order to form the corresponding spectra covariance matrix for polarization analysis. As such, to use this bundle installation of other bundles of the Noise Toolkit is not necessary.

The scripts included in this bundle are:

  1. ntk_computePolarization.py – an ObsPy script to calculate polarization parameters for a given station and time window
  2. ntk_extractPolarHour.py – a Python script to extract polarization parameters for the given channels and bounding parameters. The output is similar to the output of the ntk_extractPsdHour.py script of the PDF/PSD bundle with addition of polarization attributes.
  3. ntk_binPolarDay.py – a Python script to bin polarization attributes to daily files for a given channel tag and bounding parameters. The output is similar to that of the ntk_binPsdDay.py script of the PDF/PSD bundle with addition of polarization attributes.

The output of the polarization scripts also includes power as a function of frequency for the vertical component, the east-west component and the north-south component and the principal eigenvalue (λ).

QUICK START

Installation:

See also the bundle’s INSTALL.txt file
  • install Python 2.7 on your computer
  • additional required Python modules are:
    . matplotlib
    . numpy
    . scipy
    . obspy
  • download the package under the installation directory.
Note: if you are installing this bundle on a PC, edit the param/common.py file and set the namingConvention parameter to ‘WINDOWS

Running the scripts:

  • under the root directory of the Noise Toolkit (IRIS_NTK) execute the following command to plot polarization attributes of the NM.SLM.00.BH? data for 2 one hour windows with 50% overlap starting at 2009-01-01 01:00:00.0:

python bin/ntk_computePolarization.py param=computePolarization net=NM sta=SLM loc=DASH start=2009-01-01T01:00:00 end=2009-01-01T02:00:00 type=frequency mode=plot


Plot generated by the ntk_computePolarization.py script showing power and polarization parameters obtained by processing one hour of BHZ, BHN, BHE data of the NM.SLM station (St. Louis, MO station, Cooperative New Madrid Seismic Network, NM) between 2009-01-01 01:00:00.0 and 2009-01-01 02:00:00.0 UTC.

Next:

  • review all parameter files located under the param directory to get familiar with the script capabilities
  • use examples given below to run/test the scripts and become familiar with them
  • edit the parameter files under the IRIS_NTK/param directory to change parameters based on your needs

NOTES

  • the “DeprecationWarning: Development and maintenance efforts will focus on the new obspy.fdsn client…..” message
    that you receive from the script is caused by script loading the IRIS module and should not affect the run
  • examples below may turn on the verbose mode. Once you have configured the script, you can turn it off

COMMENTS/QUESTIONS/SUGGESTIONS:

  • We welcome patches and enhancements to this software. When developing patches, please pay particular attention to ease of use and maintenance and also keep dependencies to a minimum.
  • for issues, file a ticket under Issues

HISTORY

  • R 0.5.0 2015-10-15 Beta release

USER’S GUIDE

Use below examples to run/test the scripts and become familiar with them. Edit the parameter files under the IRIS_NTK/param directory to change parameters based on your needs.

SCRIPT: ntk_computePolarization.py

compute polarization parameters for a given station and time window using command arguments and the associated parameters in the configuration files

USAGE:

python bin/ntk_computePolarization.py param=computePolarization net=NM sta=SLM loc=DASH start=2009-01-01T01:00:00 end=2009-01-01T02:00:00 type=frequency mode=plot
          
param: configuration file name 
net: network code
sta: station code
loc: location identifier
start: interval start date time
end: interval end date time
type: x-axis type (period or frequency)
mode: plot - run in plot mode; time - run in timing mode;  verbose - run in verbose mode; 0 - run with minimum message output

NOTES & EXAMPLES:


IN ALL EXAMPLES IT IS ASSUMED THAT THE COMMAND IS ISSUED UNDER THE IRIS_NTK/ DIRECTORY


Please note that the “DeprecationWarning: Development and maintenance efforts will focus on the new obspy.fdsn client…..” message
that you receive from the script is caused by script loading the IRIS module and should not affect the run

Use the run in plot or verbose mode to tune the parameters before a production run (mode=0, minimum message output):

python bin/ntk_computePolarization.py param=computePolarization net=NM sta=SLM loc=DASH start=2009-01-01T01:00:00 end=2009-01-01T02:00:00 type=frequency mode=0

Use the x-axis type to not only define the axis type but also ask the script to create regular sampling in the corresponding

log period or log frequency. The first sample is placed at xStart second or xStart Hz as defined in the parameter file and
log-regular samples are created on both sides. User may set xStart=‘Nyquist’ in the parameter file to set the Nyquist
frequency as the reference. The former option will result the same period or frequency samples regardless of the station
sampling interval


python bin/ntk_computePolarization.py param=computePolarization net=NM sta=SLM loc=DASH start=2009-01-01T00:00:00 end=2009-01-02T00:00:00 type=frequency mode=0

If you already have your waveform data saved on a local storage as valid file format such as SAC, MSEED, CSS, etc.

(see #supported-formats at http://docs.obspy.org/packages/autogen/obspy.core.stream.read.html#supported-formats)
then you can instruct the script to get the waveform data from these files and connect to Web Services for the response information
only. To do this you need to update two parameters in your parameter file (such pas param/computePolarization.py):


set


requestClient = “FILES” to flag the script that the waveform data are coming from file
fileTag = “{IRIS_NTK_PSD}/data/TEST/SAC/W*.SAC” to tell it which files to look at



python bin/ntk_computePolarization.py param=computePolarization net=TA sta=W5 loc=DASH start=2014-03-17T04:30:00 end=2014-03-17T05:30:00 type=frequency mode=plot

the most time consuming part of the process is the waveform request. Keep your requests at reasonable size. Requesting

too many stations may cause timeouts. Script will only write the timeout message and has no way of handling it. Even for
smaller requests there is a chance that data requests fail when timeout is reported. User should scan the output messages
and re-queue the timed out requests again.

for production runs run one or more instances of scripts as a background process. In our limited testing each

3-channel 1 hour time window with 50% overlap takes about 17 seconds to process.


nohup python bin/ntk_computePolarization.py param=computePolarization net=TA sta=W56A loc=DASH start=2014-03-17T04:30:00 end=2014-03-17T05:30:00 type=frequency mode=time >& /tmp/polarW56A_2014 &
for more information on FDSN WS specifications see


"www.fdsn.org/webservices/FDSN-WS-Specifications-1.1.pdf":http://www.fdsn.org/webservices/FDSN-WS-Specifications-1.1.pdf

SCRIPT: ntk_extractPolarHour.py

a Python script to extract polarization parameters for the given bounding parameters.

USAGE:

python bin/ntk_extractPolarHour.py param=extractPolarHour net=NM sta=SLM loc=DASH chandir=BHZ_BHE_BHN start=2009-01-01T00:00:00 end=2009-01-02T00:00:00 type=frequency mode=0

param: configuration file name 
net: network code
sta: station code
loc: location identifier
start: interval start date time
end: interval end date time
type: x-axis type (period or frequency)
mode:  verbose - run in verbose mode; 0 - run with minimum message output

INPUT:

The ntk_computePolarization.py output files

NOTES & EXAMPLES:

The output is similar to the output of the ntk_extractPsdHour.py script of the PDF/PSD bundle and PQLX’s exPSDhour script

with additional polarization attributes. The output path/file name are displayed at the end of the run.


python bin/ntk_extractPolarHour.py param=extractPolarHour net=NM sta=SLM loc=DASH chandir=BHZ_BHE_BHN start=2009-01-01T00:00:00 end=2009-01-02T00:00:00 type=period mode=0

SCRIPT: ntk_binPolarDay.py

A Python script to bin polarization attributes to daily files for a given channel tag and bounding parameters.

USAGE:

  <br /><br />                                                      
python bin/ntk_binPolarDay.py param=binPolarDay net=NM sta=SLM loc=DASH chandir=BHZ_BHE_BHN start=2009-01-01 end=2009-01-02 type=frequency mode=0
   
param: configuration file name 
net: network code
sta: station code
loc: location identifier
chandir: channel directory
start: interval start date time
end: interval end date time
type: x-axis type (period or frequency)
mode: plot - verbose - run in verbose mode; 0 - run with minimum message output

INPUT:

The ntk_computePolarization.py output files

NOTES & EXAMPLES:



python bin/ntk_binPolarDay.py param=binPolarDay net=NM sta=SLM loc=DASH chandir=BHZ_BHE_BHN start=2009-01-01 end=2009-01-02 type=frequency mode=0
Full path to the output data file(s) is provided at the end of the run. You may turn off hourly file output via the configuration file

COPYRIGHT © 2015 Product Team, IRIS Data Management Center

This bundle is provided by the IRIS DMC Data Products Team WITHOUT ANY WARRANTY AND/OR SUPPORT This is a free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This script is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License (GNU-LGPL) for more details. The GNU-LGPL and further information can be found here: www.gnu.org You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.