resampleSPpairs: Resample a pair of profiles

View source: R/resampleSPpairs.R

resampleSPpairsR Documentation

Resample a pair of profiles

Description

Resample a pair of (irregularly layered) profiles onto the smallest common height grid. To reduce data storage this routine can be used to merge layers based on specified layer properties, if the input profiles have been resampled earlier, or if due to other reasons existing layers in the individual profiles can be merged. In summary, this routine alters how the layer information of snow profiles is stored without changing how the profiles appear.

Usage

resampleSPpairs(
  query,
  ref,
  mergeBeforeResampling = FALSE,
  dims = c("gtype", "hardness")
)

Arguments

query

query snowprofile or snowprofileLayers object

ref

reference snowprofile or snowprofileLayers object

mergeBeforeResampling

shall adjacent layers with identical layer properties be merged? (boolean)

dims

layer properties to consider for a potential merging

Details

The smallest common height grid is found by

  1. extract all unique layer interfaces in both profiles

  2. resample each profile with the above height grid,
    (!) but set all height values that exceed each's max snow height to that max snow height!

Value

a list with the resampled input objects under the entries query and ref.

Author(s)

fherla

See Also

resampleSP, mergeIdentLayers

Examples


## initial situation before mutual resampling:
## two profiles with different snow heights and different numbers of layers
summary(SPpairs$A_manual)[, c("hs", "nLayers")]
summary(SPpairs$A_modeled)[, c("hs", "nLayers")]
opar <- par(no.readonly=TRUE)
par(mfrow = c(1, 2))
plot(SPpairs$A_manual, main = "Initial profiles before resampling",
     ylab = "Snow height", ymax = 272)
plot(SPpairs$A_modeled, ylab = "Snow height", ymax = 272)

## resampling:
resampledSPlist <- resampleSPpairs(SPpairs$A_manual, SPpairs$A_modeled,
                                   mergeBeforeResampling = TRUE)

## two profiles with different snow heights and IDENTICAL numbers of layers
summary(resampledSPlist$query)[, c("hs", "nLayers")]
summary(resampledSPlist$ref)[, c("hs", "nLayers")]
plot(resampledSPlist$query, main = "Profiles after resampling",
     ylab = "Snow height", ymax = 272)
plot(resampledSPlist$ref, ylab = "Snow height", ymax = 272)
par(opar)


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