ctdTrim {oce}R Documentation

Trim start/end portions of a CTD cast

Description

Trim start/end portions of a CTD cast.

Usage

ctdTrim(x, method, removeDepthInversions=FALSE, parameters,
        debug=getOption("oceDebug"))

Arguments

x

A ctd object, e.g. as read by read.ctd.

method

A string (or a vector of two strings) specifying the trimming method, or a function to be used to determine data indices to keep. If method is not provided, "downcast" is assumed. See “Details”.

removeDepthInversions

Logical value indicating whether to remove any levels at which depth is less than, or equal to, a depth above. (This is needed if the object is to be assembled into a section, unless ctdDecimate will be used, which will remove the inversions.

parameters

A list whose elements depend on the method; see “Details”.

debug

a flag that turns on debugging. Set to 1 to get a moderate amount of debugging information, or to 2 to get more.

Details

Often in 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 ctdTrim with method="downcast", although it is almost always best to use plotScan to investigate the data, and then use the method="index" or method="scan" method based on visual inspection of the data. The details methods are as follows.

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 documentation for ctd-class explains the structure of CTD objects, and also outlines the other functions dealing with them.

Examples

## Not run: 
library(oce)
data(ctdRaw) 
plot(ctdRaw) # barely recognizable, due to pre- and post-cast junk
plot(ctdTrim(ctdRaw)) # looks like a real profile ...
plot(ctdDecimate(ctdTrim(ctdRaw),method="boxcar")) # ... smoothed
# Demonstrate use of a function. The scan limits were chosen
# by using locator(2) on a graph made by plotScan(ctdRaw).
trimByIndex <- function(data, parameters) {
  parameters[1] < data$scan & data$scan < parameters[2]
}
trimmed <- ctdTrim(ctdRaw, trimByIndex, parameters=c(130, 380))
plot(trimmed)

## End(Not run)

[Package oce version 0.9-18 Index]