rmsVariance: Root Mean Square and RMS Variance

rmsR Documentation

Root Mean Square and RMS Variance

Description

The rms and rmsVariance methods of Trace and Stream objects compute the Root Mean Square (RMS) amplitude or RMS variance of the associated data in each object. RMS variance removes the DC level from the seismic signal so that the zero line is consistent.

Usage

rms(x, na.rm)
parallelRms(x, na.rm)
rmsVariance(x, na.rm)
parallelRmsVariance(x, na.rm)

Arguments

x

a Trace or Stream object

na.rm

a logical specifying whether missing values should be removed

Details

Trace method

The RMS amplitude of a single Trace is calculated as:

rms(x) = √{ \frac{∑_1^n{(x_i)^2}}{n} }

The RMS variance of a single Trace is calculated as:

rmsVariance(x) = √{ \frac{∑_1^n{(x_i - \bar{x})^2}}{n} }

where x is the vector of data values and n is the length of that vector.

Stream methods

For Stream objects, data from all Traces in the stream are first extracted and concatenated into a single numeric vector after which the algorithm is applied.

The parallel~ version of this method is only available on Stream objects and returns a vector of values, one for each Trace.

By default, the Stream versions of these methods use na.rm=FALSE as there should be no missing datapoints in each Trace. The Trace methods default to na.rm=TRUE to accommodate merged traces where gaps between traces have been filled with NAs.

Value

A single numeric value is returned or NA if the trace has no data.

A numeric vector is returned for parallelRmsVariance.

Author(s)

Jonathan Callahan jonathan@mazamascience.com

Examples

## Not run: 

# Open a connection to IRIS DMC webservices
iris <- new("IrisClient")

starttime <- as.POSIXct("2012-01-24", tz="GMT")
endtime <- as.POSIXct("2012-01-25", tz="GMT")

# Get the waveform
st <- getDataselect(iris,"AK","PIN","","BHZ",starttime,endtime)

# Get the first trace and generate some statistics
tr <- st@traces[[1]]
rmsVariance(tr)

## End(Not run)

IRISSeismic documentation built on Oct. 16, 2022, 1:09 a.m.