Learn R Programming

diveMove (version 1.0)

calibrateDepth: Calibrate Depth and Generate a "TDRcalibrate" object

Description

Detect periods of major activities in a TDR record, calibrate depth readings, and generate a TDRcalibrate object essential for subsequent summaries of diving behaviour.

Usage

calibrateDepth(x, dry.thr=70, wet.thr=3610, dive.thr=4, offset,
               descent.crit.q=0.1, ascent.crit.q=0.1, wiggle.tol=0.8)

Arguments

x
An object of class TDR for calibrateDepth or an object of class TDRcalibrate for
dry.thr
Dry error threshold in seconds. Dry phases shorter than this threshold will be considered as wet.
wet.thr
Wet threshold in seconds. At-sea phases shorter than this threshold will be considered as trivial wet.
dive.thr
Threshold depth below which an underwater phase should be considered a dive.
offset
Argument to zoc. If not provided, the offset is obtained using an interactive plot of the data.
descent.crit.q
Critical quantile of rates of descent below which descent is deemed to have ended.
ascent.crit.q
Critical quantile of rates of ascent above which ascent is deemed to have started.
wiggle.tol
Proportion of maximum depth above which wiggles should not be allowed to define the end of descent. It's also the proportion of maximum depth below which wiggles should be considered part of bottom phase.

Value

Details

This function is really a wrapper around .detPhase and .detDive, which perform the work on simplified objects. It performs zero-offset correction of depth, wet/dry phase detection, and detection of dives, as well as proper labelling of the latter.

The procedure starts by first creating a factor with value L (dry) for rows with NAs for depth and value W (wet) otherwise. It subsequently calculates the duration of each of these phases of activity. If the duration of an dry phase (L) is less than dry.thr, then the values in the factor for that phase are changed to W (wet). The duration of phases is then recalculated, and if the duration of a phase of wet activity is less than wet.thr, then the corresponding value for the factor is changed to Z (trivial wet). The durations of all phases are recalculated a third time to provide final phase durations.

The next step is to detect dives whenever the zero-offset corrected depth in an underwater phase is below the supplied dive threshold. A new factor with finer levels of activity is thus generated, including U (underwater), and D (diving) in addition to the ones described above.

Once dives have been detected and assigned to a period of wet activity, phases within dives are detected using the descent, ascent and wiggle criteria. This procedure generates a factor with levels D, DB, B, BA, A, DA, and X, breaking the input into descent, descent/bottom, bottom, bottom/ascent, ascent, and non-dive, respectively.

See Also

TDRcalibrate, zoc

Examples

Run this code
data(divesTDR)
divesTDR

## Consider a 3 m offset, and a dive threshold of 3 m
dcalib <- calibrateDepth(divesTDR, dive.thr=3, offset=3)
if (dev.interactive(orNone=TRUE)) {
    plotTDR(dcalib, labels="dive.phase", surface=TRUE)
}

Run the code above in your browser using DataLab