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.
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
Returns
a list with the resampled input objects under the entries query and ref.
Details
The smallest common height grid is found by
extract all unique layer interfaces in both profiles
resample each profile with the above height grid,
(!) but set all height values that exceed each max snow height to that max snow height!
Examples
## initial situation before mutual resampling:## two profiles with different snow heights and different numbers of layerssummary(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 layerssummary(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)