slice {IRISSeismic} | R Documentation |
Slice a section out of a Trace
or Stream
Description
The slice
methods of Trace
and Stream
objects return like objects
that are subsets of the original.
Usage
slice(x, starttime, endtime)
Arguments
x |
a |
starttime |
time at which the slice should begin |
endtime |
time at which the slice should end |
Details
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.
Value
A new Trace
or Stream
object is returned.
Author(s)
Jonathan Callahan jonathan@mazamascience.com
Examples
## 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)
[Package IRISSeismic version 1.6.6 Index]