| rms | R Documentation |
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.
rms(x, na.rm)
parallelRms(x, na.rm)
rmsVariance(x, na.rm)
parallelRmsVariance(x, na.rm)
x |
a |
na.rm |
a logical specifying whether missing values should be removed |
Trace method
The RMS amplitude of a single Trace is calculated as:
rms(x) = \sqrt{ \frac{\sum_1^n{(x_i)^2}}{n} }
The RMS variance of a single Trace is calculated as:
rmsVariance(x) = \sqrt{ \frac{\sum_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.
A single numeric value is returned or NA if the trace has no data.
A numeric vector is returned for parallelRmsVariance.
Jonathan Callahan jonathan@mazamascience.com
## Not run:
# Open a connection to EarthScope 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.