prep1wig | R Documentation |
Takes list of traces and prepares new list for analysis in RSEIS
prep1wig(wig=vector(), dt=1, sta="STA", comp="CMP",
units="UNITS", starttime=list(yr=0, jd=1,mo=1,dom=1,
hr=1,mi=1,sec=0) )
wig |
vector of time series |
dt |
sample interval |
sta |
character, station name |
comp |
character,component name |
units |
character, units of signal |
starttime |
list(yr=1972, jd=1,mo=1,dom=1,hr=1,mi=1,sec=0) |
prep1wig is offered to reformat a time series
for input to program swig()
Rsac output list
amp |
amplitude |
dt |
sample rate |
nzyear |
year |
nzhour |
hour |
nzmin |
minutes |
nzsec |
seconds |
nzmsec |
msec |
b |
sac stuff |
e |
sac stuff |
o |
sac stuff |
fn |
character, file name |
sta |
character |
comp |
character |
DATTIM |
list of date and time |
N |
number of points |
units |
character |
Jonathan M. Lees<jonathan.lees.edu>
swig, prepSEIS
data(sunspots)
AA <- attributes(sunspots)
starttime<-list(yr=AA$tsp[1], jd=1,mo=1,dom=1,hr=0,mi=0,sec=0)
ES <- prep1wig(wig=sunspots, dt=1/12, sta="STA", comp="CMP",
units="UNITS", starttime=starttime )
EH<-prepSEIS(ES)
STDLAB <- c("DONE", "zoom out", "refresh", "restore",
"XTR", "SPEC", "SGRAM" ,"WLET")
###### set SHOWONLY=FALSE for interactive
xx <- swig( EH, STDLAB = STDLAB, SHOWONLY=0)
####################
####################
#################### example with multiple signals
dt <- 0.001
t <- seq(0, 6, by=0.001)
###### sample rate = 1000 Hz, 0.001 seconds 601 samples
### set up the fequencies and amplitudes for signals that have 2 frequencies
afreqs1 <- c(50, 40,10, 5 )
amps1 <- c(6, 2,3, 2 )
####
afreqs2 <- c(120,30,20, 30 )
amps2 <- c(10,5, 9, 2 )
x <- cbind( amps1[1]*sin(2*pi*afreqs1[1]*t) +
amps2[1]* sin(2*pi*afreqs2[1]*t),
amps1[2]*sin(2*pi*afreqs1[2]*t) + amps2[2]* sin(2*pi*afreqs2[2]*t),
amps1[3]*sin(2*pi*afreqs1[3]*t) + amps2[3]* sin(2*pi*afreqs2[3]*t),
amps1[4]*sin(2*pi*afreqs1[4]*t) + amps2[4]* sin(2*pi*afreqs2[4]*t))
d <- dim(x)
######## names of signals
mysta<-c("R1", "R2", "R3", "R4")
MYLIST <- list()
starttime <- list(yr=2008, jd=1,mo=1,dom=1,hr=0,mi=0,sec=0)
############ set up the initial list of wiggles
for(i in 1:d[2])
{
A <- prep1wig(wig =x[,i], sta=mysta[i], dt=dt, comp="DO",
units= "amp", starttime=starttime)
A[[1]]$DATTIM$yr <- 2000
MYLIST <- c(MYLIST, A)
}
### reorganize into RSEIS format:
PH1 <- prepSEIS(MYLIST)
STDLAB <- c("DONE", "zoom out", "refresh", "restore",
"XTR", "SPEC", "SGRAM" ,"WLET")
swig(PH1, STDLAB = STDLAB)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.