The sampleRateChannelMetric() function compares the miniSEED sample rate with the sample rate stored in the metadata channel.
sampleRateChannelMetric(st,
channel_pct=1,
chan_rate=NULL)
A list of lists is returned containing:
m1
= list of sample_rate_channel
metric objects
a Stream
object containing a seismic signal
percentage by which the miniSEED and channel sample rates must agree to be considered a match
metadata channel sample rate from miniSEED blockette 52, stationXML, or other metadata representation <Channel:SampleRate> element, optional
Mary Templeton mary.templeton@earthscope.org
This function retrieves the sample rate of the first trace from a Stream
object and compares
it to the metadata channel sample rate passed as chan_rate
to see whether both sample rates agree within
channel_pct
percent. If chan_rate is not provided, the code will retrieve a sample rate
from EarthScope web services.
The sampleRateChannelMetric function calculates and returns the following metrics:
A boolean measurement that returns 0 if miniSEED and Channel sample rates agree within 1%, or 1 if they disagree.
SingleValueMetric
if (FALSE) {
# Open a connection to EarthScope webservices
iris <- new("IrisClient")
starttime <- as.POSIXct("2019-08-01",tz="GMT")
endtime <- as.POSIXct("2019-08-02",tz="GMT")
# Get channel-level metadata, sample rate and normalizaton frequency
meta <- IRISSeismic::getChannel(iris, "IU","ANMO","00","BHZ",starttime,endtime)
chan_rate <- meta$samplerate
# Get the waveform
st <- IRISSeismic::getDataselect(iris,"IU","ANMO","00","BHZ",starttime,endtime)
# Calculate the sample rate metrics
list1 <- sampleRateChannelMetric(st,channel_pct=1,chan_rate)
}
Run the code above in your browser using DataLab