Learn R Programming

sarp.snowprofile.alignment (version 1.0.2)

simSP: Similarity measure between snow profile pairs

Description

A simple similarity score --based on avalanche hazard relevant characteristics-- is calculated for two snow profiles that have been aligned onto the same height grid (either through DTW or resampling). If one profile contains more layers than the other one, the layers with a non-matched height represent missing layers and will be treated accordingly. The similarity score is weighted according to grain type classes to accredit the importance of weak layers, new snow and crusts against less important bulk layers. The similarity measure is compatible with top-down alignments and is symmetric with respect to its inputs, i.e. simSP(P1, P2) == simSP(P2, P1).

Usage

simSP(
  ref,
  qw,
  gtype_distMat = sim2dist(grainSimilarity_evaluate(triag = FALSE)),
  verbose = FALSE,
  returnDF = FALSE
)

Arguments

ref

snowprofile object 1

qw

snowprofile object 2 (matched layers need to be on the same height grid of ref)

gtype_distMat

a distance matrix that stores distance information of grain types (Be careful to convert similarities, as in grainSimilarity_evaluate, into dissimilarities with sim2dist.)

verbose

print similarities of different grain classes to console? default FALSE

returnDF

additionally return the similarities of the grain classes as data.frame (analogously to verbose); the return object then has the fields $sim and $simDF

Value

Either a scalar similarity between [0, 1] with 1 referring to the two profiles being identical, or (if returnDF is TRUE) a list with the elements $sim and $simDF.

Details

The grain classes contain the following grain types:

  • weak layers (wl): SH and DH

  • new snow (pp): PP and DF

  • crusts (cr): MFcr and IF

  • bulk: the rest (i.e., predominantly RG, FC, FCxr --- MF falls also in here, will maybe be adjusted in future.)

Examples

Run this code
# NOT RUN {
## first align two profiles
alignment <- dtwSP(SPpairs$A_modeled, SPpairs$A_manual)

## then assess the similarity of the aligned profiles
SIM <- simSP(alignment$queryWarped, alignment$reference, verbose = TRUE)

# }

Run the code above in your browser using DataLab