Learn R Programming

IRISMustangMetrics (version 2.4.6)

crossCorrelationMetric: Correlation between channels

Description

The crossCorrelationMetric() function calculates the maximum absolute correlation (polarity_check) and lag at maximum correlation (timing_drift) associated with two streams of seismic data.

Usage

crossCorrelationMetric(st1, st2, maxLagSecs=10, filter)

Value

A list with one GeneralValueMetric object is returned. The metric names is polarity_check.

Arguments

st1

a Stream object containing a seismic signal

st2

a Stream object containing a seismic signal

maxLagSecs

maximum number of seconds of lag to use

filter

a signal package filter to be applied before cross-correlating, optional

Author

Jonathan Callahan jonathan@mazamascience.com (R code), Mary Templeton mary.templeton@earthscope.org (algorithm)

Details

Details of the algorithm are as follows:

  • Both signals are demeaned and detrended

  • If one signal has a higher sampling rate, it is decimated to the lower sampling rate using an IIR filter if it is a multiple of the lower sample rate. See (signal::decimate).

  • Both signals are filtered, by default with a Butterworth 2-pole low pass filter with a 0.1 Hz (10 second) corner frequency. See (signal::filter).

  • Signals are cross-correlated using the stats::ccf() function.

The maximum absolute correlation is saved as polarity_check while the lag at peak correlation is saved as timing_drift.

Note: For cross-correlation, seismic signals must not have any gaps -- they must be contained in a single Trace object.

Examples

Run this code
  if (FALSE) {
# Open a connection to IRIS DMC webservices
iris <- new("IrisClient")

# Get the same signal, shifted by 3 seconds
starttime <- as.POSIXct("2013-11-12 07:09:45",tz="GMT")
endtime <- starttime + 600
st1 <- getSNCL(iris,"NM.SLM.00.BHZ",starttime,endtime)
st2 <- getSNCL(iris,"NM.SLM.00.BHZ",starttime+3,endtime+3)

# Cross-correlate
crossCorrelationMetric(st1,st2)
  }

Run the code above in your browser using DataLab