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, 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.
    Step 1.
    The pressure data are despiked with a smooth() filter with method "3R". This removes wild spikes that arise from poor instrument connections, etc.
    Step 2.
    If no parameters are given, then any data with negative pressures are deleted. If there is a parameter named pmin, then that pressure (in decibars) is used instead as the lower limit. This is a commonly-used setup, e.g. ctd2 <- ctd.trim(ctd, parameters=list(pmin=1)) removes the top decibar (roughly 1m) from the data.
    Step 3.
    The maximum pressure is determined, and data acquired subsequent to that point are deleted. This removes the upcast and any subsequent data.
    Step 4.
    An initial equilibrium phase is removed by a regression of pressure on scan number. The model has zero pressure for some initial portion, and then a constant increase with scan number. Then this initial zero-pressure portion is deleted. (The regression may fail, and if so, a warning is printed, and this step is skipped.)
"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 the list stored in parameters. This list has elements from (the lower limit) and to (the upper limit) Sensible things happen if only one limit is given. For example, ctd2 <- ctd.trim(ctd, "scan", list(from=5)) starts at scan number 5 and continues to the end, while ctd3 <- ctd.trim(ctd, "scan", list(from=5,to=100)) also starts at scan 5, but extends only to scan 100.
parameters A list whose elemetns depend on the method; see above.
verbose If set to TRUE, some debugging information is provided, including a suggested call based on the scan number, which can serve as a good starting point for manual trimming.

Details

For normal CTD profiling, the goal is to isolate only the downcast, discarding measurements made in the air, in an equilibration phase in which the device is held below the water surface, and then the upcast phase that follows the downcast. This is handled reasonably well by ctd.trim with method="downcast". (The datasets provided with oce were produced this way.)

However, for detailed work it makes sense to do things semi-manually. The eye is simply better at handling exceptional cases. The process is simple: use plot.ctd.scan() to get an idea of the scan indices of the downacast, and then use ctd.trim with method="index". A few trials will normally identify the downcast very well.

Value

An object of class "ctd", with data having been trimmed in some way.

Author(s)

Dan Kelley

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.raw) 
plot(ctd.raw) # barely recognizable, due to pre- and post-cast junk
plot(ctd.trim(ctd.raw)) # looks like a real profile ...
plot(ctd.decimate(ctd.trim(ctd.raw),method="boxcar")) # ... smoothed

[Package oce version 0.1-76 Index]