ctdDecimate(x, p = 1, method = "boxcar", e = 1.5, debug = getOption("oceDebug"))
ctd
object, i.e. one inheriting from ctd-class
.p
dbars. If a vector of pressures is given, interpolation is done to
these pressures."boxcar"
(based on a local average), "approx"
(based on linear
interpolation between neighboring points), "lm"
(based on local
regression, with e
setting the size of the local region), "rr"
(for the Reineger and Ross method, carried out with oce.approx
)
and "unesco"
(for the UNESCO method, carried out with.
oce.approx
. If method
is a function, then it must take
three arguments, the first being pressure, the second being an arbitrary
variable in another column of the data, and the third being a vector of target
pressures at which the calculation is carried out, and the return value must be
a vector. See Examples."boxcar"
and "lm"
methods. If e=1
, then the
neighbourhood for the i-th pressure extends from the (i-1
)-th pressure to
the (i+1
)-th pressure. At the endpoints it is assumed that the outside
bin is of the same pressure range as the first inside bin. For other values of
e
, the neighbourhood is expanded linearly in each direction. If the
"lm"
method produces warnings about "prediction from a rank-deficient
fit", a larger value of "e"
should be used.oce
functions. Generally, setting debug=0
turns off the printing, while higher values suggest that more information
be printed.ctd-class
, with pressures that are as set by
the "p"
parameter and all other properties modified appropriately.
handleFlags
or some other means to
deal with flags before calling the present function."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 the more common 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.)Note that 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.Other things related to ctd
data: [[,ctd-method
,
[[<-,ctd-method
, as.ctd
,
cnvName2oceName
, ctd-class
,
ctdFindProfiles
, ctdRaw
,
ctdTrim
, ctd
,
handleFlags,ctd-method
,
plot,ctd-method
, plotProfile
,
plotScan
, plotTS
,
read.ctd.itp
, read.ctd.odf
,
read.ctd.sbe
,
read.ctd.woce.other
,
read.ctd.woce
, read.ctd
,
subset,ctd-method
,
summary,ctd-method
,
woceNames2oceNames
, write.ctd
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