DCOffsetTimesMetric: DC Offset Detection

View source: R/DCOffsetTimesMetric.R

DCOffsetTimesMetricR Documentation

DC Offset Detection


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


DCOffsetTimesMetric(st, windowSecs, incrementSecs, threshold)



a Stream object containing a seismic signal


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


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


threshold used in the detection metric (default=0.9)


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


A list with a single MultipleTimeValueMetric object is returned.


The denominator of this metric was tested with both mean(chunk std devs) and with median(chunk std devs) to identify a "typical" value for the chunk standard deviation. It was found that using median resulted false offset detects whenever there was a large seismic signal in an otherwise lo-noise signal.


Jonathan Callahan jonathan@mazamascience.com


## Not run: 
# Open a connection to IRIS DMC 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

## End(Not run)

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