GLEON / rLakeAnalyzer

An R version of Lake Analyzer
43 stars 26 forks source link

'mixed.cutoff' inconsistency #107

Open 231Harriet opened 3 years ago

231Harriet commented 3 years ago

Hi there,

I have a suggested change for the 'mixed.cutoff' object in the meta.depths() and thermo.depth() functions.

Currently, the 'mixed.cutoff' object is a user specified filter that removes profiles which are not sufficiently stratified to define a metalimnion top/bottom. The units of this filter are water temperature range, and are defaulted to 1°C. See code from thermo.depth();

if (diff(range(wtr, na.rm = TRUE)) < mixed.cutoff) { return(NaN) }

However, considering that the thermocline, metalimnion top and bottom are all defined using units of the density gradient between consecutive sensors, it is inconsistent to use a water temperature based filter. This is particularity problematic for the metalimnion top/bottom because it is possible for the mixed.cutoff value to be met even when the 'slope' object (i.e. the user defined threshold that is used to determine what can be considered as homogeneous) has not been met.

Therefore, I propose that the mixed.cutoff value is removed and where the 'slope' is not met at all in the water column profile, the metalimnion/depth is returned as NA.