
ctdDecimate(x, p, method=c("approx","boxcar","lm","reiniger-ross"),
e=1.5, debug=getOption("oceDebug"))
ctd
object, e.g. as read by read.ctd
.p
is not supplied, a list of regularly-spaced pressures is
computed based on the mean pressure difference between samples
(converted to a round value using
"approx"
method is based on the R
function approx
and is a simple linear interpolation
between neighbouring points"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. In other respects, the return value is identical with the input ctd
object (apart from its having an additional log entry indicating that the data have been altered.)"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 is probably 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(RRprofile)
ctd <- as.ctd(RRprofile$salinity,RRprofile$temperature,RRprofile$depth)
plotProfile(ctd, "T", Tlim=c(2,9))
ctd2 <- ctdDecimate(ctd,p=seq(0,2000,1),method="reiniger-ross")
lines(temperature(ctd2), pressure(ctd2), col="blue")
Run the code above in your browser using DataLab