Learn R Programming

IRISSeismic (version 1.6.7)

getUpDownTimes: Determine times when a channel starts/stops collecting data

Description

The getUpDownTimes method determines the on/off times for data collection within a Stream and returns a list containing these times, ignoring Traces with a duration less than min_signal as well as data dropouts that are less than min_gap.

Usage

getUpDownTimes(x, min_signal, min_gap)

Value

A vector of POSIXct datetimes associated with on/off transitions.

Arguments

x

Stream object

min_signal

minimum Trace duration in seconds (default=30)

min_gap

minimum gap in seconds (default=60)

Author

Jonathan Callahan jonathan@mazamascience.com

Details

A Stream object returned by getDataselect contains a list of individual Trace objects, each of which is guaranteed to contain a continuous array of data in the Trace@data slot. Each Trace also contains a starttime and an endtime representing a period of uninterrupted data collection. Data dropouts are determined by first rejecting any Traces of duration less than min_signal. The temporal spacing between Traces is then analyzed, ignoring spaces shorter than min_gap.

This method first checks the SNCL id of each Trace to make sure they are identical and throws an error if they are not.

The first element returned is always the starttime associated the first Trace. The last element is always the endtime associated with the last trace. Thus, when the first element is identical to the starttime of the web services data request this does not necessarily mean that the channel was down before this.

NOTE: Even when data are complete for the duration of the requested timespan, the last element returned may be earlier than the endtime of the web services data request by up to a second.

See Also

plotUpDownTimes

Examples

Run this code
if (FALSE) {
# 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)

# Determine up/down transitions, ignoring Traces < 3 min and gaps < 5 min
upDownTimes <- getUpDownTimes(st, min_signal=180, min_gap=300)

# Or just plot them directly
plotUpDownTimes(st, min_signal=180, min_gap=300)
}

Run the code above in your browser using DataLab