Skip to contents

This function is used to find the time cues for the start and end of either dives in a depth record or flights in an altitude record.


find_dives(p, mindepth, sampling_rate = NULL, surface = 1, findall = 0)



A depth or altitude time series (a sensor data list or a vector) in meters.


The threshold in meters at which to recognize a dive or flight. Dives shallow or flights lower than mindepth will be ignored.


The sampling rate of the sensor data in Hz (samples per second).


(optional) The threshold in meters at which the animal is presumed to have reached the surface. Default value is 1. A smaller value can be used if the dive/altitude data are very accurate and you need to detect shallow dives/flights.


(optional) When TRUE, forces the algorithm to include incomplete dives at the start and end of the record. Default is FALSE which only recognizes complete dives.


dives is a data frame with one row for each dive/flight found. The columns of dives are: start (time in seconds of the start of each dive/flight), end (time in seconds of the start of each dive/flight), max (maximum depth/altitude reached in each dive/flight), tmax (time in seconds at which the animal reaches the max depth/altitude).


BW <- beaked_whale
dives <- find_dives(p = BW$P$data, 
sampling_rate = BW$P$sampling_rate, 
mindepth = 25, surface = 5, 
findall = FALSE)