ctd.decimate {oce} | R Documentation |
Smooth and decimate a CTD profile.
ctd.decimate(x, p=NULL, method=c("boxcar","lm"), e=1)
x |
a ctd object, e.g. as read by read.ctd . |
p |
controls the selection of pressure levels, as follows.
If NULL (the default), then the list of pressures for the decimation is to be selected automatically, using pretty . If a single
value is supplied, then the pressure list starts at the surface and increments
with the indicated value, down to the bottom. If a list is supplied,
then this is taken to be the desired pressure list. |
method |
Method for calculating decimated values.
Use "boxcar" (the default)
for boxcar averaging within the pressure region.
Use "lm" to use the prediction of a linear
model applied to each pressure region. (See e
for an explanation of the region.) |
e |
is an expansion coefficient used to calculate the smoothing neighbourhoods.
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. |
This function is useful for calculations that require data to be defined at a fixed set of pressure values. Normally, the target pressures are supplied by the user (e.g. to simplify thermal-wind calculations based on pairs of CTD profiles), but the routine can select the target pressures automatically. The smoothing part of the algorithm is based on neighbourhoods of each target pressures.
Note that the density that results from the decimation is calculated from an average, and so it may not match with the averaged salinity and temperature. This is a sort of numerical cabeling effect, and if you would like to avoid this, just do as follows
xd <- ctd.decimate(x) xd$data$sigma <- sw.sigma(xd$data$salinity, xd$data$temperature, xd$data$pressure)
A new ctd
object.
Dan Kelley Dan.Kelley@Dal.Ca
A 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)