if (FALSE) {
# EXAMPLE (1): Differential accumulation across bedding couplets
ex=etp(tmin=0,tmax=1000,dt=5,pWt=1,oWt=0,eWt=1,esinw=TRUE)
ex2=diffAccum(ex,0.01,.05)
ex2=linterp(ex2)
# first with the nominal timeOpt approach
timeOpt(ex2,sedmin=1,sedmax=4,numsed=100)
timeOptSim(ex2,sedmin=1,sedmax=4,numsed=100,numsim=2000)
# then with the timeOptTemplate approach
timeOptTemplate(ex2,sedmin=1,sedmax=4,difmin=.5,difmax=6,numsed=100,ncores=2)
timeOptTemplateSim(ex2,sedmin=1,sedmax=4,difmin=.5,difmax=6,numsed=100,numsim=1000,
ncores=2)
# EXAMPLE (2): Linear sedimentation rate increase
ex=etp(tmin=0,tmax=1000,dt=5,pWt=1,oWt=0,eWt=1,esinw=TRUE)
ex2=sedRamp(ex,srstart=0.01,srend=0.05)
ex2=linterp(ex2)
# first with the nominal timeOpt approach
timeOpt(ex2,sedmin=1,sedmax=4,numsed=100)
# then with the timeOptTemplate approach
# create linear model for input. the magnitude does not matter, it will be rescaled.
# (it just needs to be a line)
template=ex2; template[2]=ex2[1]
timeOptTemplate(ex2,template=template,sedmin=1,sedmax=4,difmin=.5,difmax=6,numsed=100,ncores=2)
# view optimization procedure (must set ncores=1)
timeOptTemplate(ex2,template=template,sedmin=2.75,sedmax=3.25,difmin=.5,difmax=6,numsed=20,
ncores=1,genplot=2)
# EXAMPLE (3): Step increase in sedimentation rate, from 1 cm/kyr to 2 cm/kyr at 7 meters depth
ex=etp(tmin=0,tmax=1000,dt=5,pWt=1,oWt=0,eWt=1,esinw=TRUE)
ex2=ex
ex2[1]=ex[1]*.01
ex2[141:201,1]=ex2[141:201,1]*2-7
ex2=linterp(ex2)
# first with the nominal timeOpt approach
timeOpt(ex2,sedmin=1,sedmax=4,numsed=100)
# then with the timeOptTemplate approach
# create step model for input. the magnitude does not matter, it will be rescaled.
template=ex2; template[1:140,2]=1; template[141:261,2]=2
timeOptTemplate(ex2,template=template,sedmin=1,sedmax=4,numsed=100,ncores=2)
# view optimization procedure (must set ncores=1)
timeOptTemplate(ex2,template=template,sedmin=1,sedmax=2,numsed=20,ncores=1,genplot=2)
# EXAMPLE (4): A record with a 100 kyr hiatus at 10 meters depth
ex=etp(tmin=0,tmax=1000,dt=5,pWt=1,oWt=0,eWt=1,esinw=TRUE)
ex2=delPts(ex,del=101:121)
# use a background sedimentation rate of 2 cm/kyr
ex2[1]=0:179*5*0.02
# first evaluate the distorted record with the nominal timeOpt approach
timeOpt(ex2,sedmin=1,sedmax=4,numsed=100)
# then with the timeOptTemplate approach
# create a constant sedimentation rate template with possible hiatus of unknown
# duration at 10 m
template=ex2; template[2]=10; template[101,2]=1
timeOptTemplate(ex2,template=template,sedmin=1,sedmax=3,difmax=3,numsed=100,ncores=2)
# now perform a finer grid search near the maximum, using power only
# notice the oscillatory nature of the power fit.
res=timeOptTemplate(ex2,template=template,sedmin=1.5,sedmax=2,difmax=3,numsed=100,
ncores=2,iopt=2,output=2)
# compare true eccentricity to TimeOpt-derived eccentricity
pl(2)
plot(ex,type="l",main="True Eccentricity Series",xlab="True Time (kyr)",ylab="")
plot(res[,1],res[,4],type="l",main="Black=TimeOpt precession AM; Red=TimeOpt eccentricity model",
xlab="TimeOpt derived time (kyr)",ylab="")
lines(res[,1],res[,5],col="red",lwd=2)
}
Run the code above in your browser using DataLab