Packages needing loading

library(rLakeAnalyzer)
library(knitr)

Split and merge algorithm

Water column identification is provided by the split-and-merge algorithm. Implementation of the split-and-merge algorithm for a water profile occurs within the wtr.layer() function:

Simple application of the split and merge algorithm

Below is a simple one profile example of determining key water column parameters using the split-and-merge algorithm. The default behaviour for wtr.layer is to run the algorithm without specifying the number of segments. wtr.layer() adopt as defaults the convention of a minimum depth (z0) of 2.5 m, a maximum depth (zmax) of 150 m and a error threshold (thres) of 0.1.

data("latesummer")
wldf <- wtr.layer(depth = latesummer$depth, measure = latesummer$temper)
knitr::kable(wldf)

In this example, you'll note that wldf$cline is formatted as a list-column. A thorough demonstration of a list column can be found here. This type of data format has been included here to consolidate split and merge results and align the output to work well with tidyverse tools. If you are interested in working with the segments data from wtr.layer(), use this approach:

wldf$segments

Note that the axes of the water column profile have been reversed and flipped to better visualize the water column and conform to standard limnological displays.

plot(y = latesummer$depth, x = latesummer$temper, ylim = rev(range(latesummer$depth)))
abline(h = wldf$cline, col='blue')
abline(h = wldf$mld, col='red')
abline(h = wldf$min_depth, col='green')
text(16, wldf$cline+3, "Thermocline", col = 'blue')
text(16, wldf$mld+3, "Mix Layer Depth", col = 'red')
text(16, wldf$min_depth+3, "Minimum Depth", col = 'green')

Important references



GLEON/rLakeAnalyzer documentation built on May 3, 2021, 1:32 p.m.