merge.Rd
Merge of two VoxelSpace
object.
Voxel spaces must have same sptial extension and resolution, and some
shared column names.
Variables i, j, k & ground_distance
are merged.
Variables nbEchos, nbSampling, lgTotal, bsEntering, bsIntercepted, bsPotential, weightedEffectiveFreepathLength & weightedFreepathLength
are summed-up.
Variables sdLength, angleMean and distLaser
are weighted means with
nbSampling
(the number of pulses) as weights.
Attenuation FPL variables (attenuation_FPL_biasedMLE, attenuation_FPL_biasCorrection, attenuation_FPL_unbiasedMLE) & lMeanTotal
are calculated analytically.
Transmittance and attenuation variables (except the FPL attenuation variables listed above) are weighted means with bsEntering as weights.
Any other variables will not be merged. In particular PAD variables
are not merged and should be recalculated with
plantAreaDensity()
on the merged voxel space.
Merging several voxel spaces works as follow : vxsp1 and vxsp2 merged
into vxsp12. vxsp12 & vxsp3 merged into vxsp123, etc. The process can be
synthesized with the Reduce()
function.
# S3 method for VoxelSpace
merge(x, y, ...)
VoxelSpace
objects to be merged.
Not used
A merged VoxelSpace
object.
# merge same voxel space to confirm merging behavior
vxsp1 <- readVoxelSpace(system.file("extdata", "tls_sample.vox", package = "AMAPVox"))
vxsp2 <- readVoxelSpace(system.file("extdata", "tls_sample.vox", package = "AMAPVox"))
vxsp <- merge(vxsp1, vxsp2)
#> Warning: Variable `PadBVTotal` does not have predefined merging mode. Discarded from merging.
all(vxsp$nbSampling == vxsp1$nbSampling + vxsp2$nbSampling)
#> [1] TRUE
# with PAD
vxsp <- plantAreaDensity(merge(vxsp1, vxsp2), pulse.min = 1)
#> Warning: Variable `PadBVTotal` does not have predefined merging mode. Discarded from merging.
all((vxsp$pad_transmittance - vxsp1$PadBVTotal) < 1e-7) # equal at float precision
#> [1] TRUE