assignDatetags: Assign layers in simulated snow profiles to precomputed...

View source: R/assignDatetags.R

assignDatetagsR Documentation

Assign layers in simulated snow profiles to precomputed datetags

Description

This routine assigns each layer of simulated snow profiles to precomputed datetags. Conceptually, each datetag represents a date when the surface layers get buried by new snow. To assign layers to datetags, the routine chooses the closest datetag that is older than the layer formation date. This routine needs precomputed datetags, which are currently computed based on precipitation patterns by functions in other packages. Once layers are assigned to datetags, layers from different locations or times can easily be grouped by their datetags.

Usage

assignDatetags(
  x,
  potentialDatetags,
  vdate = NULL,
  adjust_bdates = FALSE,
  computeBDate = TRUE,
  checkMonotonicity = ifelse(computeBDate, TRUE, FALSE),
  ...
)

## S3 method for class 'snowprofileSet'
assignDatetags(
  x,
  potentialDatetags,
  vdate = NULL,
  adjust_bdates = FALSE,
  computeBDate = TRUE,
  checkMonotonicity = ifelse(computeBDate, TRUE, FALSE),
  ...
)

## S3 method for class 'snowprofile'
assignDatetags(
  x,
  potentialDatetags,
  vdate = NULL,
  adjust_bdates = FALSE,
  computeBDate = TRUE,
  checkMonotonicity = ifelse(computeBDate, TRUE, FALSE),
  ...
)

## S3 method for class 'snowprofileLayers'
assignDatetags(
  x,
  potentialDatetags,
  vdate,
  adjust_bdates = FALSE,
  computeBDate = TRUE,
  checkMonotonicity = ifelse(computeBDate, TRUE, FALSE),
  ...
)

Arguments

x

a snowprofileSet, snowprofile or snowprofileLayers object

potentialDatetags

a character or Date array of all potential datetags of the season. This array is currently provided by sarp.2021.herla.snowprofilevalidation::derivePotentialDatetags() only.

vdate

date when the profile and layer information is valid (i.e., profile$date)

adjust_bdates

boolean switch to compute bdates that are more similar to human interpretation. Deprecated and not recommeneded, see Details.

computeBDate

compute burial dates (bdates) from layer deposition dates?

checkMonotonicity

check ascending order of layers. This acts as a check for whether multiple layers objects are stacked, which is not allowed.

...

passed on to subsequent methods

Details

As a side effect and to issue warnings when layers might not be assigned to meaningful datetags, the routine also computes the exact burial dates (bdates) of layers, which is the ddate of the overlying layer. For snowpack simulations with thin layer resolution, this approach yields very similar ddates and bdates for most layers, since most layers form and instantly get buried by another layer of the same storm. Before implementing the aforementioned approach of pre-computing datetags based on weather patterns, this routine attempted to make bdates more similar to human interpretation by adjusting bdates, so that (similar) layers with the same ddate (i.e., same storm) inherit the same bdate (similar means: identical gtype & hardness). This feature is still available by setting adjust_bdates to TRUE, which is not recommended, though.

Value

The input object will be returned with the columns datetag and bdate added to the profile layers

Methods (by class)

  • assignDatetags(snowprofileSet): for snowprofileSets

  • assignDatetags(snowprofile): for snowprofiles

  • assignDatetags(snowprofileLayers): for snowprofileLayers

Author(s)

fherla

See Also

deriveBDate, guessDatetagsSimple

Examples

## TODO: create a meaningful example!


sarp.snowprofile documentation built on Jan. 14, 2026, 9:06 a.m.