drift_stat: Use brokensticks to identify potential drifts

Description Usage Arguments Details Value Examples

View source: R/funs_delim.r

Description

drift_stat takes an object and return a data frame of all the brokenstick segments along the trip with statistics such as their vertical speed (average and standard deviation), their duration and so on. This data frame is to be filtered to identify drift segments.

Usage

1
drift_stat(object, thres.bsm = 5, bsm = NULL)

Arguments

object

a SES object including a TDR dataset, a "dives statistics" table and a "delim" table.

thres.bsm

a threshold to use with max_dist_cost when running optBrokenstick.

bsm

A list of brokenstick models to use directly instead of computing a new one with thres.bsm as parameter.

Details

To get average pitch and roll angles (degrees), the TDR table must include static acceleration with variable names "axG", "ayG" and "azG". Similarly, for swimming effort and PCA rate, the TDR table must have columns "swm_eff" (numeric) and "is_pca" (logical). Use functions static_acc, swimming_effort and prey_catch_attempts to compute these variables from the raw acceleration readings.

Value

A data frame of all brokenstick segments with start and end index of the segment, no_seg_tot and ID number of the segement, no_seg_dive the number of the segment within its dive, no_dive the ID of the dive conataining the segment, time the starting time of segment, drift_rate the vertical speed of the segment, dur the duration of the segment, min_depth and max_depth the minimum and maximum depths of the segment, acceleration statistics (if acceleration data available) average roll, pitch and swimming effort and PCA rate, the mean squared residuals of the segment.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
data(exses)
ind(exses)
exses$drift <- drift_stat(exses)

# Filter drift segments from drift_stat output table
is_drift <- with(exses$drift, dur >= 100 & drift_rate %bw% c(-0.4, 0.6) & abs(roll) >= 90)
tmp <- exses$drift[is_drift, ]

# Time series are good way to check drift segments selection
plot(drift_rate ~ time, tmp, ylim = c(-0.4, 0.6))

# Various ways to save result to slots of exses
exses$drift         <- tmp
exses$no_drift_dive <- unique(tmp$no_dive)
exses$tdr$is_drift  <- tdrexpand(rep(TRUE, nrow(tmp)), ty = tmp, na_value = FALSE)
exses$stat$is_drift <- exses$stat$no_dive %in% exses$no_drift_dive

# Plot a sample
par(mfrow = c(3,3))
no_drft <- sample(exses$no_drift_dive, 9, replace = FALSE)
tdrply(plot, c("time", "depth", "is_drift"), no = no_drft, la = list(main = no_drft))
par(mfrow = c(1,1))

SESman/rbl documentation built on June 24, 2017, 8:48 a.m.