TDRcalibrate object essential for subsequent summaries
of diving behaviour.calibrateDepth(x, dry.thr=70, wet.thr=3610, dive.thr=4,
zoc.method=c("visual", "offset", "filter"), ...,
interp.wet=FALSE, descent.crit.q=0.1,
ascent.crit.q=0.1, wiggle.tol=0.8)TDR for
calibrateDepth or an object of class
TDRcalibrate for filter
(k, probs, depth.bounds (defaults to range),
na.rm (defaults to TRUE)) and offset (offset).TDRcalibrate. Method plotTD, which plots depth
and, optionally, speed vs. time with the ability of zooming in and out
on time, changing maximum depths displayed, and panning through time.
The button to zero-offset correct sections of the record allows for
the collection of
Method
Method .depth.filter. It relies on function
runquantile from the caTools package.
The method calculates the first running quantile defined by
probs[1] on a moving window of size k[1]. The next
running quantile, defined by probs[2] and k[2], is
applied to the smoothed/filtered depth measurements from the previous
step, and so on. The corrected depth measurements (d) are calculated
as:
$$d=d_{0} - d_{n}$$
where $d_{0}$ is original depth and $d_{n}$ is the
last smoothed/filtered depth. This method is under development, but
reasonable results can be achieved by applying two filters (see
na.rm=TRUE works well when
there are no level shifts between non-NA phases in the data, but
na.rm=FALSE is better in the presence of such shifts. In other
words, there is no reason to pollute the moving window with NAs when
non-NA phases can be regarded as a continuum, so splicing non-NA
phases makes sense. Conversely, if there are level shifts between
non-NA phases, then it is better to retain NA phases to help the
algorithm recognize the shifts while sliding the window(s). The
search for the surface can be limited to specified bounds during
smoothing/filtering, so that observations outside these bounds are
interpolated using the bounded smoothed/filtered series.
Once the whole record has been zero-offset corrected, remaining depths below zero, are set to zero, as these are assumed to indicate values at the surface.
.detPhase,
.detDive, and .zoc which perform the work on simplified
objects. It performs wet/dry phase detection, zero-offset correction
of depth, and detection of dives, as well as proper labelling of the
latter. The procedure starts by first creating a factor with value depth and value dry.thr, then the values in the factor for that phase
are changed to wet.thr, then the corresponding value for the factor is
changed to
Zero-offset correction of depth is performed at this stage (see
Some instruments produce a peculiar pattern of missing data near the
surface, at the beginning and/or end of dives. The argument
interp.wet may help to rectify this problem by using an
interpolating spline function to impute the missing data, constraining
the result to a minimum depth of zero. Please note that this optional
step is performed after ZOC and before identifying dives, so that
interpolation is performed through dry phases coded as wet because
their duration was briefer than dry.thr. Therefore,
dry.thr must be chosen carefully to avoid interpolation through
legitimate dry periods.
The next step is to detect dives whenever the zero-offset corrected
depth in an underwater phase is below the specified dive threshold. A
new factor with finer levels of activity is thus generated, including
Once dives have been detected and assigned to a period of wet
activity, phases within dives are identified using the descent, ascent
and wiggle criteria (see
TDRcalibrate, .zoc,
.depthFilter .detPhase,
.detDive.data(divesTDR)
divesTDR
## Consider a 3 m offset, and a dive threshold of 3 m
dcalib <- calibrateDepth(divesTDR, dive.thr=3, zoc.method="offset",
offset=3)
## Or ZOC algorithmically with method="filter":
## This can take a while due to large window needed for 2nd
## filter in this dataset
dcalib <- calibrateDepth(divesTDR, dive.thr=3, zoc.method="filter",
k=c(3, 5760), probs=c(0.5, 0.02), na.rm=TRUE)
if (dev.interactive(orNone=TRUE)) {
plotTDR(dcalib, labels="dive.phase", surface=TRUE)
}Run the code above in your browser using DataLab