Dive Data Analysis¶
For dive data analysis Kenozooid integrates with R, which is free software environment for statistical computing and graphics.
Kenozooids converts diving data stored in UDDF files into R data structures and allows to execute R scripts to perform data analysis and plotting.
Several data anlysis scripts are provided by Kenozooid (see Data Analysis Scripts). For example, to calculate RMV:
$ kz analyze rmv.R -a examples/rmv.csv 15 -k 19 dumps/ostc-dump-18.uddf
time avg_depth avg_rmv
1 4 5.5 48.4
2 9 6.1 41.4
3 17 6.3 32.5
4 24 6.4 26.7
Data Analysis Scripts¶
The list of data analysis scripts provided by Kenozooid is as follows
- rmv.R
calculate respiratory minute volume (RMV)
Respiratory Minute Volume (RMV)¶
Use rmv.R script to calculate respiratory minute volume (RMV).
The script accepts two parameters
- csv file
CSV file with two columns -
timeandpressure. Time is dive run time in minutes and pressure is tank pressure in bars.- tank
Size of tank in liters.
The output of the script is a table with columns
- time
Dive run time in minutes.
- avg_depth
Average dive depth.
- avg_rmv
Average RMV for running time and average depth.
For example, create dive-19-rmv.csv file:
time,pressure
0,210
4,190
9,170
17,150
24,140
Then execute rmv.R script for 15l tank:
$ kz analyze rmv.R -a dive-19-rmv.csv 15 -k 19 dumps/ostc-dump-18.uddf
time avg_depth avg_rmv
1 4 5.5 48.4
2 9 6.1 41.4
3 17 6.3 32.5
4 24 6.4 26.7
Custom Data Analysis Scripts¶
Custom data analysis scripts consist of three steps
parse script arguments (optional)
perform data analysis
create analysis output
Kenozooid will deliver all dive data and script arguments to a script. The data structures created by Kenozooid for a script are described in Data Structures.
A script is responsible to deliver data analysis output, i.e. it should print results on screen or create PDF files.
For example, create dhours.R script to summarize total amount of diving
hours:
secs = sum(kz.dives$duration)
print(sprintf('Total dive hours %.1f', secs / 3600))
Execute it with Kenozooid:
$ kz analyze dhours.R examples/logbook.uddf
[1] "Total dive hours 2.1"
Data Structures¶
The data available for analysis on R level can be accessed with kz
object. The following data are provided by Kenozooid
kz.argsList of script arguments passed from Kenozooid command line user interface.
kz.divesData frame containing dive data.
kz.profilesData frame containing dive profile data.
The data frame containig dive information has the following columns
numberDive number.
datetimeDate and time of a dive.
depthMaximum depth of dive in meters.
durationDive duration in minutes.
tempMinimum dive temperature recorded during dive.
The data frame containig dive profile information has the following columns
diveDive number to reference dive - row number in
kz.divesdata frame.depthDepth during the dive.
timeDive time in seconds.
tempTemperature during the dive.
deco_timeTime of deepest deco stop at given time of dive (deco ceiling length).
deco_depthDepth of deco stop at give time of dive (deco ceiling).
gas_nameName of gas mix switched at given depth.
gas_o2O2 percentage of switched gas mix.
gas_heHelium percentage of switched gas mix.
mod_lowMaximum operating depth (MOD) for gas mix at 1.4 PPO2.
mod_highMaximum operating depth (MOD) for gas mix at 1.6 PPO2.