Learn R Programming

IRISSeismic (version 1.6.6)

DDT: Apply demean, detrend, cosine taper

Description

The DDT method of Trace objects returns a new Trace where data in the @data slot have been modified. This is typically required before peforming any kind of spectral analysis on the seismic trace.

Usage

DDT(x, demean, detrend, taper)

Value

A new Trace object is returned.

Arguments

x

a Trace object

demean

logical specifying whether to deman (default=TRUE)

detrend

logical specifying whether to detrend (default=TRUE)

taper

proportion of the signal to be tapered at each end (default=0.1)

Author

Jonathan Callahan jonathan@mazamascience.com

Details

Use taper=0 for no tapering.

Examples

Run this code
# Open a connection to IRIS DMC webservices
iris <- new("IrisClient")

# P-wave onset for a big quake
starttime <- as.POSIXct("2010-02-27 06:30:00", tz="GMT")
endtime <- as.POSIXct("2010-02-27 07:00:00", tz="GMT")
result <- try(st <- getDataselect(iris,"IU","ANMO","00","BHZ",starttime,endtime))
if (inherits(result,"try-error")) {
  message(geterrmessage())
} else {
  tr <- st@traces[[1]]
  trClean <- DDT(tr,TRUE,TRUE,0.1)
  layout(matrix(seq(2)))
  plot(tr)
  abline(h=0,col='gray60')
  mtext("Raw",side=3,line=-2,adj=0.05,col='red')
  plot(trClean)
  abline(h=0,col='gray60')
  mtext("Demean - Detrend - Cosine Taper",line=-2,side=3,adj=0.05,col='red')
}

# Restore default layout
layout(1)

Run the code above in your browser using DataLab