getSingleValueMetrics: Retrieve measurements from the MUSTANG BSS

getSingleValueMetricsR Documentation

Retrieve measurements from the MUSTANG BSS


The getSingleValueMetrics method of the IrisClient makes a request of the MUSTANG database and returns a dataframe containing metrics that are stored as single values, e.g. sample_max, sample_min, etc..


getSingleValueMetrics(obj, network, station, location, channel, 
                           starttime, endtime, metricName, constraint, url)



an IrisClient object


a character string with the two letter seismic network code


a character string with the station code


a character string with the location code


a character string with the three letter channel code


a POSIXct class specifying the starttime (GMT)


a POSIXct class specifying the endtime (GMT)


a character string containing one or more comma separated metric names


a character string containing value constraints


optional url of the MUSTANG measurements service


A blank location code should be specified as location="--"; Using location="" will return all location codes.

The default MUSTANG measurement service when url is not specified is:

Data returned from MUSTANG are converted into an R dataframe.

The optional constraint parameter is used to add constraints to the query as defined in the MUSTANG measurements web service documentation. Any string passed in with the constraint parameter will be appended to the request url following an ampersand.

Error returns from the BSS will stop evaluation and generate an error message.

Most MUSTANG metrics are single valued and can be retrieved with getSingleValueMetrics(). Examples of multi-valued metrics that cannot be returned with this function include "asl_coherence", "orientation_check", and "transfer_function".

getMustangMetrics() is a similar function that will return values for all metrics, not just single valued ones. It is the preferred method of retrieving MUSTANG metric values.


A dataframe with the following columns:

~metricName~, value, snclq, starttime, endtime, loadtime

The loadtime column contains the time at which this record was loaded into the database.

The dataframe rows will be sorted by increasing starttime.

The structure of this dataframe is appropriate for use with the ggplot2 plotting package.


The database was originally populated with a version of this package that always assigned quality to be 'B'. Later versions obtained the quality from the miniSEED packet (typically 'M'). Because of this it is possible to have duplicate entries that only differ in the Q part of their snclq. To avoid double counting, when the webservice return contains two records whose only difference is the quality code portion of the of the snclq, only the record with the later loaddate will be used in the dataframe.


Jonathan Callahan

See Also

createBssUrl, getPsdMetrics


  ## Not run: 
# Open a connection to IRIS DMC webservices (including the BSS)
iris <- new("IrisClient", debug=TRUE)

starttime <- as.POSIXct("2013-06-01", tz="GMT")
endtime <- starttime + 30*24*3600
metricName <- "sample_max,sample_min,sample_mean"

# Get the measurement dataframe
juneStats <- getSingleValueMetrics(iris,"IU","ANMO","00","BHZ",


# Simple ggplot2 plot
#p <- ggplot(juneStats, aes(x=starttime,y=value, color=as.factor(metricName))) +
#     geom_step()

## End(Not run)

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