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.
    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.
    Any data with negative pressures are deleted. This removes in-air 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 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 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.74 Index]