if (FALSE) {
# Open a connection to EarthScope 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