Last chance! 50% off unlimited learning
Sale ends in
ctdDecimate(x, p=1, method="approx", e=1.5, debug=getOption("oceDebug"))
ctd
object, e.g. as read by read.ctd
.p
dbars. If a vector of pressures is given,
interpolation is done to these press"boxcar"
(the default method, based on a local
average), "approx"
("boxcar"
and "lm"
methods. If
e=1
, then the neighbourhood for the i-th pressure extends from
the (i-1
)-th pressTRUE
to debug the reading process.class
"ctd"
, with pressures that
are as set by the "p"
parameter and all other properties modified
appropriately."approx"
method is best for bottle data, in which
the usual task is to interpolate from a coarse sampling grid to a
finer one. For CTD data, the "boxcar"
method may be the
best choice, because the task is normally to sub-sample, and some
degree of smoothing is usually desired. (The "lm"
method is
quite slow, and the results are similar to those of the boxcar
method.)NB. A sort of numerical cabeling effect can result from this procedure, but it can be avoided as follows
xd <- ctdDecimate(x) xd[["sigmaTheta"]] <- swSigmaTheta(xd[["salinity"]],xd[["temperature"]],xd[["pressure"]])
ctd-class
explains the structure
of CTD objects, and also outlines the other functions dealing with them.library(oce)
data(ctd)
plotProfile(ctd, "salinity", ylim=c(10, 0))
p <- seq(0, 45, 1)
ctd2 <- ctdDecimate(ctd, p=p)
lines(ctd2[["salinity"]], ctd2[["pressure"]], col="blue")
p <- seq(0, 45, 1)
ctd3 <- ctdDecimate(ctd, p=p, method=function(x,y,xout)
predict(smooth.spline(x, y, df=30), p)$y)
lines(ctd3[["salinity"]], ctd3[["pressure"]], col="red")
Run the code above in your browser using DataLab