I am interested in the vertical distribution of the leaf area density (LAD) in my plot. That is why I am seeking to create voxels that represent LAD. I've been trying to achieve this with the voxel_metrics()
function. According to the documentation of this function the inputs necessary are a LAS object, a function to be applied to the voxels, and a resolution of the voxels.
The functions that can be applied to the voxels work the same way as the grid_metrics()
function. One of the pre-made functions is the LAD function which computes a LAD value per voxel.
My limited experience in scripting got me this far:
library(lidR)
library(lidRplugins)
LASfile <- system.file("extdata", "Megaplot.laz", package="lidR")
las = readLAS(LASfile)
voxelsLAD = voxel_metrics(las, ~LAD(z=las@data$Z, dz = 1, k= 0.5, z0= 1), 5)
plot(voxelsLAD, color = "lad", colorPalette = heat.colors(5), bg = "black", legend = TRUE)
The resulting LAD values range from 0.00009805 to 0.247 which are in line with the values retrieved by the original research of which the function is based on. So far so good you would say, however plotting these values turned out to be difficult. The colorpalette does not apply itself to the voxels as can be seen in this image (all voxels retrieve the same color):
Right now I'm not sure whether this problem can be fixed by computing the LAD voxels otherwise (I might be misusing voxel_metrics()), or by plotting the voxels otherwise.
FYI; I'm using Windows 10 with R 3.5.0