backtrackLayers: Backtrack layers from average or summary profile

View source: R/backtrackLayers.R

backtrackLayersR Documentation

Backtrack layers from average or summary profile


An average profile as computed by dbaSP summarizes the prevalent layer properties of the entire profile set. To better understand the distribution of layer properties within the set, use this function to retrieve layers of interest from the individual profiles of the original profile set.


  layer = NA,
  profileSet = NULL,
  layer_units = "row#",
  condition = NULL,
  computationByHeight = FALSE



an average profile as per dbaSP


the height or row number of the layer to retrieve the distribution for (given as height or row number of the average profile). If layer is NA, all layers from the avgProfile are considered.


the profile set that is averaged by avgProfile. Optimally, it is the resampled profile set as returned by dbaSP or averageSP, see parameter computationByHeight if that resampled profile set is not available anymore.


either "row#" or "cm"


a condition that subsets which layers are returned. E.g., only layers with a specific grain type, etc.. Note that the condition needs to be substituted in the function call, e.g. condition = substitute(gtype == "SH"). In most cases, it's best to subset the data.frame manually after this function has been called. A secret and dangerous trick is to use condition = substitute(gtype %in% return_conceptually_similar_gtypes(as.character(avgProfile$layers$gtype[lidx]))) to get the very same layers that have been used to compute the median layer properties which are included in the avgProfile$layers.


There are two ways of how to backtrack layers that were aligned to avgProfile$layers. The first and safest approach is by index, which requires the resampled profileSet as returned by dbaSP or averageSP. The second approach is by layer height, which should yield the same results (beta phase: still bugs possible, check yourself!) and allows to backtrack the layers even if the resampled profileSet is not available anymore, but only the original unmodified set which was used to create the average profile.


This function returns a list of data.frames with the backtracked layers. Each (named) list item corresponds to a specific layer height (cm).




## See Vignette for examples.

sarp.snowprofile.alignment documentation built on Aug. 8, 2022, 1:05 a.m.