Learn R Programming

IRISMustangMetrics (version 2.4.7)

DCOffsetTimesMetric: DC Offset Detection

Description

The DCOffsetTimesMetric() function returns times where a shift in the signal mean is detected.

Usage

DCOffsetTimesMetric(st, windowSecs, incrementSecs, threshold)

Value

A list with a single MultipleTimeValueMetric object is returned.

Arguments

st

a Stream object containing a seismic signal

windowSecs

chunk size (secs) used in DCOffset calculations (default=1800)

incrementSecs

increment (secs) for starttime of sequential chunks (default=windowSecs/2)

threshold

threshold used in the detection metric (default=0.9)

Author

Jonathan Callahan jonathan@mazamascience.com

Details

Conceptually, this algorithm asserts: If the difference in means between sequential chunks of seismic signal is greater than the typical std dev of a chunk then this marks a DC offset shift.

Details of the algorithm are as follows


# Merge all traces in the time period, filling gaps with missing values
# Break up the signal into windowSecs chunks spaced incrementSecs apart
# For each chunk calculate:
#     signal mean, signal standard deviation
# Resulting mean and std dev arrays are of length 47 for 24 hours of signal
# Metric = abs(lagged difference of chunk means) / mean(chunk std devs)
# DC offset = times when Metric > threshold

Examples

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

# Get a signal with a DC offset problem
starttime <- as.POSIXct("2012-10-26",tz="GMT")
endtime <- starttime + 2*24*3600
st <- getDataselect(iris,"IU","TARA","00","BHZ",starttime,endtime)

# Calculate the metric
metricList <- DCOffsetTimesMetric(st)

# Extract values from the first element of the list
offsetTimes <- metricList[[1]]@values

# Plot the signal and mark locations where a DC offset was detected
plot(st)
abline(v=offsetTimes,col='red')
}

Run the code above in your browser using DataLab