ctd.decimate(x, p, method=c("approx","boxcar","lm"), e=1)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. The "boxcar" and "lm" methods.
If e=1, then the neighbourhood for the i-th pressure extends from the (i-1)-th pressure
to the (<ctd object 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 <- ctd.decimate(x) xd$data$sigma.theta <- sw.sigma.theta(xd$data$salinity, xd$data$temperature, xd$data$pressure)
ctd object may be read with read.ctd,
and ctd.trim is useful in trimming spurious data
(e.g. those obtained during the upcast).library(oce)
data(ctd.raw)
ctd.clean <- ctd.decimate(ctd.trim(ctd.raw))
summary(ctd.clean)Run the code above in your browser using DataLab