ctdFindProfiles {oce} | R Documentation |
Examine the pressure record looking for extended periods of either ascent or descent, and return either indices to these events or a vector of CTD records containing the events.
ctdFindProfiles(x, cutoff=0.5, minLength=10, minHeight=0.1*diff(range(x[["pressure"]])), direction=c("descending", "ascending"), arr.ind=FALSE, debug=getOption("oceDebug"), ...)
x |
|
cutoff |
criterion on pressure difference; see “Details”. |
minLength |
lower limit on number of points in candidate profiles. |
minHeight |
lower limit on height of candidate profiles. |
direction |
string indicating the travel direction to be selected |
arr.ind |
should array indices be returned, or a vector of ctd objects? |
debug |
a flag that turns on debugging. Set to 1 to get a moderate amount of debugging information, or to 2 to get more. |
... |
extra arguments that are passed to |
The method works by examining the pressure record. First, this is smoothed using
smooth.spline
, which is provided with any extra arguments as supplied to the present
function, e.g. ctdFindProfiles(..., df=10)
uses a spline with 10 degrees of freedom. The
spline is then first differenced with diff
. Median values of the positive and
negative first-difference values are then multiplied by cutoff
. This establishes criteria
for any given point to be in an ascending profile, a descending profile, or a non-profile.
Contiguous regions are then found, and those that have fewer than minLength
points are
discarded. Then, those that have pressure ranges less than minHeight
are discarded.
It is often necessary to pass the resultant profiles through ctdTrim
, to remove
artifacts such as an equilibration phase, etc.
If arr.ind=TRUE
, a data frame with columns start
and end
, the indices of
the downcasts. Otherwise, a vector of ctd
objects.
Dan Kelley
The documentation for ctd-class
explains the structure
of CTD objects, and also outlines the other functions dealing with them.
## Not run: library(oce) d <- read.csv("towyow.csv", header=TRUE) towyow <- as.ctd(d$salinity, d$temperature, d$pressure) casts <- ctdFindProfiles(towyow) par(mfrow=c(length(casts), 3)) for (cast in casts) { plotProfile(cast, "salinity") plotProfile(cast, "temperature") plotTS(cast, type='o') } ## End(Not run)