crossCorrelationMetric: Correlation between channels

View source: R/crossCorrelationMetric.R

crossCorrelationMetricR Documentation

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)

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

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.

Value

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

Note

The metricList generated for this two-channel metric will have an additional sncl2 attribute identifying the SNCL in st2.

Author(s)

Jonathan Callahan jonathan@mazamascience.com (R code), Mary Templeton met@iris.washington.edu (algorithm)

Examples

  ## Not run: 
# 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)
  
## End(Not run)

IRISMustangMetrics documentation built on April 28, 2022, 1:06 a.m.