MultipleTimeValueMetric-class | R Documentation |
"MultipleTimeValueMetric"
A container for metrics consisting of a vector of POSIXct
datetimes. This information is used to create XML that is
then submitted to the MUSTANG Backend Storage System (BSS).
Objects can be created by calls of the form:
new("MultipleTimeValueMetric", snclq, starttime, endtime, metricName, values)
Lists of MultipleTimeValueMetric
objects are returned by various metrics functions in this package.
snclq
:Object of class "character"
: SNCLQ identifier.
metricName
:Object of class "character"
: Name of the metric.
elementName
:Object of class "character"
: Name of the datetime element (default="t"
).
starttime
:Object of class "POSIXct"
: Start time.
endtime
:Object of class "POSIXct"
: End time.
values
:Object of class "POSIXct"
: Datetime values.
valueStrings
:Object of class "character"
: String representations of the datetime values.
quality_flag
:Object of class "numeric"
: Quality flag.
quality_flagString
:Object of class "character"
: String representation of quality flag.
signature(object = "MultipleTimeValueMetric")
: Prettyprints the information in the MultipleTimeValueMetric
The starttime
and endtime
slots are typically associated with the user requested times
which may not match up with the
starttime
associated with the first Trace
and the endtime
associated with last Trace
in the Stream
object being analyzed. This ensures that
metrics results for a single time period but covering many stations or channels will have the same date range and
improves performance of the BSS which expects XML of the following form:
<measurements> <date start='2012-02-10T00:00:00.000' end='2012-02-10T09:20:00.000'> <target snclq='N.S.L.C1.Q'> <up_down_times> <t value="2012-02-10T00:00:00.000"/> <t value="2012-02-10T00:01:00.000"/> <t value="2012-02-10T00:02:00.000"/> <t value="2012-02-10T00:03:00.000"/> </up_down_times> </target> </date> </measurements>
The quality_flag
is an optional value available for storing information related to the
processing of a particular metric. Its meaning will vary from metric to metric.
Jonathan Callahan jonathan@mazamascience.com
upDownTimesMetric
## Not run:
# Open a connection to IRIS DMC webservices
iris <- new("IrisClient")
# Get the waveform
starttime <- as.POSIXct("2012-01-24", tz="GMT")
endtime <- as.POSIXct("2012-01-25", tz="GMT")
st <- getDataselect(iris,"AK","PIN","","BHZ",starttime,endtime)
# Make sure we're working with a single snclq
unique_ids <- uniqueIds(st)
if (length(unique_ids) > 1) {
stop(paste("meanMetric: Stream has",unique_ids,"unique identifiers"))
}
snclq <- unique_ids[1]
# get the upDownTimes with a minimum signal length and minimum gap (secs)
upDownTimes <- getUpDownTimes(st, min_signal=30, min_gap=60)
# Create and return a MultipleTimeValue metric from the upDownTimes
m <- new("MultipleTimeValueMetric", snclq=snclq,
starttime=starttime, endtime=endtime,
metricName="up_down_times", values=upDownTimes)
# Show the results
show(m)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.