Learn R Programming

IRISSeismic (version 1.6.6)

eventWindow: Return a portion of a trace surrounding an event.

Description

The eventWindow method of Trace uses the picker returned by the STALTA() method to center a window around the the event detected by the picker.

Usage

eventWindow(x, picker, threshold, windowSecs)

Value

A new Trace object is returned.

Arguments

x

a Trace object

picker

a picker as returned by the STALTA() method applied to this Trace

threshold

the threshold at which the picker is 'triggered'

windowSecs

the size of the window in secs

Author

Jonathan Callahan jonathan@mazamascience.com

Details

This utility function uses the trace method triggerOnset() to determine p-wave onset followed by the slice() method to return a new Trace object of the desired size centered near the event onset.

When no threshold value is supplied, the default value is calculated as:

threshold=quantile(picker,0.999,na.rm=TRUE)

See Also

STALTA, triggerOnset

Examples

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

# Seismic signal in third trace
tr <- st@traces[[3]]

# Create a picker
picker <- STALTA(tr,3,30)
threshold <- quantile(picker,0.99999,na.rm=TRUE)

# 3 rows
layout(matrix(seq(3)))

# Plot trace and p-wave closeups
closeup1 <- eventWindow(tr,picker,threshold,3600)
closeup2 <- eventWindow(tr,picker,threshold,600)
plot(tr)
plot(closeup1,subsampling=1)
abline(v=length(closeup1)/2, col='red')
plot(closeup2,subsampling=1)
abline(v=length(closeup2)/2, col='red')

# Restore default layout
layout(1)
}

Run the code above in your browser using DataLab