slice | R Documentation |
Trace
or Stream
The slice
methods of Trace
and Stream
objects return like objects
that are subsets of the original.
slice(x, starttime, endtime)
x |
a |
starttime |
time at which the slice should begin |
endtime |
time at which the slice should end |
The returned object will always be a subset of the x
argument whose time range is the
intersection of the original time range and the requested range. When there is no intersection
or when starttime > endtime
an error is generated.
All metadata associated with the returned Trace
or Stream
will reflect
the new object, rather than the original.
A new Trace
or Stream
object is returned.
Jonathan Callahan jonathan@mazamascience.com
## Not run: # Open a connection to IRIS DMC webservices iris <- new("IrisClient") starttime <- as.POSIXct("2002-04-20", tz="GMT") endtime <- as.POSIXct("2002-04-21", tz="GMT") # Get the waveform st <- getDataselect(iris,"US","OXF","","BHZ",starttime,endtime) # This Stream object consists of 5 Traces length(st@traces) # Plotting the third trace shows a small quake plot(st@traces[[3]]) # We can slice out the hour that has the quake signal sliceStart <- as.POSIXct("2002-04-20 10:30:00", tz="GMT") sliceEnd <- as.POSIXct("2002-04-20 11:30:00", tz="GMT") stSlice <- slice(st, sliceStart, sliceEnd) # Now we only have one Trace of an hour duration length(stSlice@traces) stSlice@traces[[1]]@stats # And a better look at the quake signal plot(stSlice@traces[[1]]) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.