merge: Merge two voxel spaces

merge.VoxelSpaceR Documentation

Merge two voxel spaces

Description

Merge of two VoxelSpace object. Voxel spaces must have same sptial extension and resolution, and some shared column names.

Merging modes

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.

vxsp <- plantAreaDensity(merge(vxsp1, vxsp2))

Merging multiple voxel spaces

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.

vxsp <- Reduce(merge, list(vxsp1, vxsp2, vxsp3))

Usage

## S3 method for class 'VoxelSpace'
merge(x, y, ...)

Arguments

x, y

VoxelSpace objects to be merged.

...

Not used

Value

A merged VoxelSpace object.

Examples

# 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)
all(vxsp$nbSampling == vxsp1$nbSampling + vxsp2$nbSampling)

# with PAD
vxsp <- plantAreaDensity(merge(vxsp1, vxsp2), pulse.min = 1)
all((vxsp$pad_transmittance - vxsp1$PadBVTotal) < 1e-7) # equal at float precision


AMAPVox documentation built on July 9, 2023, 5:32 p.m.