Learn R Programming

oce (version 0.2-1)

ctdDecimate: Decimate a CTD profile

Description

Interpolate a CTD profile to specified pressure values.

Usage

ctdDecimate(x, p, method=c("approx","boxcar","lm","reiniger-ross"),
             e=1.5, debug=getOption("oceDebug"))

Arguments

x
a ctd object, e.g. as read by read.ctd.
p
an optional pressure increment, or list of pressures. If 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
method
the method to be used for calculating decimated values. The default "approx" method is based on the R function approx and is a simple linear interpolation between neighbouring points
e
is an expansion coefficient used to calculate the local neighbourhoods for the "boxcar" and "lm" methods. If e=1, then the neighbourhood for the i-th pressure extends from the (i-1)-th press
debug
a Boolean, set to TRUE to debug the reading process.

Value

  • An object of 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.)

Details

The "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$data$sigmaTheta <- swSigmaTheta(xd$data$salinity, xd$data$temperature, xd$data$pressure)

References

R.F. Reiniger and C.K. Ross, 1968. A method of interpolation with application to oceanographic data. Deep Sea Research, 15, 185-193.

See Also

A ctd object may be read with read.ctd, and ctdTrim is useful in trimming spurious data (e.g. those obtained during the upcast).

Examples

Run this code
library(oce)
data(RRprofile)
ctd <- as.ctd(RRprofile$salinity,RRprofile$temperature,RRprofile$depth)
plot.profile(ctd, "T", Tlim=c(2,9))
ctd2 <- ctdDecimate(ctd,p=seq(0,2000,1),method="reiniger-ross")
lines(ctd2$data$temperature, ctd2$data$pressure, col="blue")

Run the code above in your browser using DataLab