ctd.trim {oce}R Documentation

Trim start/end portions of a CTD cast

Description

Trim start/end portions of a CTD cast.

Usage

ctd.trim(x, method="downcast",parameters=NULL, verbose=FALSE)

Arguments

x A ctd object, e.g. as read by read.ctd.
method Various methods exist, some of which use parameters:
"downcast"
Select only data for which the CTD is descending. This is done in stages.
1. The pressure data are despiked with a smooth() filter with method "3R". This removes wild spikes that arise from poor instrument connections, etc.
2 Any data with negative pressures are deleted. This removes in-air data.
3. The maximum pressure is determined, and data acquired subsequent to that point are deleted. This removes the upcast and any subsequent data.
4. At this stage, most datasets consist only of the actual downcast, plus an initial period of equilibration during which pressure is nearly constant. Trimming this equilibration period is surprisingly difficult, and is done in two stages. First, the first-difference of pressure is computed, along with its confidence interval. (By default, the 0.95 confidence level is used but parameters[1] will be used if provided.) Points are removed if their first difference in pressure is less than this lower limit.
5. This often leaves a handful of equilibration points that just happened to be falling through the water column (e.g. by heaving of the vessel in surface waves). To remove such points, a regression is done of pressure against scan number, and the scan number at which the regression passes through zero pressure is noted. Points measured before this scan number are deleted.
"index"
Select values only in indicated list of indices, e.g. selection <- ctd.trim(ctd, "index", seq(10,30)) selects data points 10, 11, ... 30.
"(ANYTHING ELSE)"
Select data only if the named item (e.g. scan, time, etc.) falls in the range of values indicated by parameters. If one parameter is given, it is a lower limit. If two parameters are given, they are a range. For example, ctd2 <- ctd.trim(ctd, "scan", 5) starts at scan number 5 and continues to the end, while ctd3 <- ctd.trim(ctd, "scan", c(5,100)) also starts at scan 5, but extends only to scan 100.
parameters Depends on method; see above.
verbose If set to TRUE, some debugging information is provided.

Details

For a quick look at the data, the method="downcast" scheme is normally quite adequate. However, a wise user will seek want to exert more control over the trimming process. Visual inspection is a good way to do this, using plot.ctd.scan() together with ctd.trim. Normally, this involves identifying by eye an initial period in which the CTD is in the air or unequilibrated in the water, and a final period in which the CTD is no longer descending. Quite often this final period is easier to find by eye than with the downcast method, since the instrument operator may leave the device in deep water for some extra time to fire off a water bottle, etc., yielding problematic CTD data (but with some wonderful chemical or biological samples).

Value

A new ctd object.

Author(s)

Dan Kelley Dan.Kelley@Dal.Ca

References

The Seabird CTD instrument is described at http://www.seabird.com/products/spec_sheets/19plusdata.htm.

See Also

The ctd object may be read with read.ctd. plot.ctd.scan is very useful in providing guidance for trimming with ctd.trim.

Examples

library(oce)
data(ctd) 
ctd.trimmed <- ctd.trim(ctd, "pressure", c(3, 5))
summary(ctd.trimmed)

[Package oce version 0.1.67 Index]