Find the start and end of dives in a depth


Matlab & Octave

T = find_dives(p,fs,mindepth) 
	   or
T = find_dives(p,fs,mindepth,surface) 
	   or
T = find_dives(p,fs,mindepth,surface,findall) 

R

T = find_dives(p,fs,mindepth) 
	   or
T = find_dives(p,fs,mindepth,surface) 
	   or
T = find_dives(p,fs,mindepth,surface,findall) 

Find time cues for the start and end of either dives in a depth record or flights in an altitude record.

Input var Description Units Default value
p is a depth or altitude time series (vector) meters N/A
fs is the sampling rate of the sensor data Hz (samples per second) N/A
mindepth is the threshold at which to recognize a dive or flight. meters N/A
surface is the threshold at which the animal is presumed to have reached the surface. meters 1
findall when 1 forces the algorithm to include incomplete dives at the start and end of the record. N/A 0 (only recognize complete dives)
Output var Description Units
T is a structure array with size equal to the number of dives/flights found. The fields of T 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,tmaxtime in seconds at which the animal reaches the max depth/altitude N/A
  • Dives shallow or flights lower than mindepth will be ignored.
  • A smaller value for surface can be used if the dive/altitude data are very accurate and you need to detect shallow dives/flights.
  • If there are n dives/flights beyond mindepth in p, then T will be a structure containing n-element vectors, e.g., to access the start time of the kth dive/flight use T.start(k).

Matlab & Octave

The example below uses data from the file testset1.nc. You can download it from the animaltags website's example data sets. If the file is saved in your current working directory, load it via:

testset1 = load_nc(‘testset1.nc’)
T = find_dives(testset1.P.data, testset1.P.sampling_rate, 5)

R

The example below uses data from the file testset1.nc. You can download it from the animaltags website's example data sets. If the file is saved in your current working directory, load it via:

testset1 <- load_nc(‘testset1.nc’)
T <- find_dives(p = testset1$P$data, fs = testset1$P$sampling_rate, mindepth = 5, surface = 2, findall = NULL)

bugs@animaltags.org Last modified: 10 May 2017

  • tagwiki/tools/processing/find_dives.txt
  • Last modified: 2017/07/28 17:15
  • by das39