backtrackLayers: Backtrack layers from average or summary profile

Description Usage Arguments Value Author(s) Examples

View source: R/backtrackLayers.R

Description

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.

Usage

1
2
3
4
5
6
7
8
backtrackLayers(
  avgProfile,
  layer = NA,
  profileSet = NULL,
  layer_units = "row#",
  condition = NULL,
  computationByHeight = FALSE
)

Arguments

avgProfile

an average profile as per dbaSP

layer

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.

profileSet

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.

layer_units

either "row#" or "cm"

condition

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.

computationByHeight

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.

Value

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

Author(s)

fherla

Examples

1
## Not yet included; create avgProfile example object first.

sarp.snowprofile.alignment documentation built on Feb. 10, 2022, 5:07 p.m.