resampleSPpairs: Resample a pair of profiles

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/resampleSPpairs.R

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

1
2
3
4
5
6
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 snowheight to that max snowheight!

Value

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

Author(s)

fherla

See Also

resampleSP, mergeIdentLayers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## 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", ylim = c(0, 272))
plot(SPpairs$A_modeled, ylab = "Snow height", ylim = c(0, 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", ylim = c(0, 272))
plot(resampledSPlist$ref, ylab = "Snow height", ylim = c(0, 272))
par(opar)

sarp.snowprofile.alignment documentation built on Dec. 3, 2020, 9:08 a.m.