make_voxelforest_parallel: Make a voxel forest from a tree list using parallelization

View source: R/make_voxelforest_parallel_function.R

make_voxelforest_parallelR Documentation

Make a voxel forest from a tree list using parallelization

Description

Function that creates a voxel forest and returns it as a data.table.

Usage

make_voxelforest_parallel(
  trees.dt,
  minx = 0,
  maxx,
  miny = 0,
  maxy,
  vxl.per.sqm = 4,
  stems = F,
  ground = T,
  aggregation.func = "max",
  keep = NA,
  run.parallel = F,
  frac.cores = 0.5,
  res = 100
)

Arguments

trees.dt

A data.table (or data.frame) that contains all trees that form the voxelforest provided with specific requirements: Each row represents one individual. The columns need to have the following names and content: X = X-coordinate of tree position, Y = Y-coordinate of tree position; H = tree height (m), CD = tree crown diameter (m), CL = tree crown length (m), LAD = leaf area density of the tree (m2/m3), CS = tree crown shape (coding: 1 = cylinder, 2 = spheroid, 3 = cone, 4 = icecone)

minx

Minimum X-coordinate of the simulated area

maxx

Maximum X-coordinate of the simulated area

miny

Minimum Y-coordinate of the simulated area

maxy

Maximum Y-coordinate of the simulated area

vxl.per.sqm

Spatial resolution of the simulation in voxels per square meter

stems

Boolean whether to include tree stems in the simulation or not

ground

Boolean whether to include forest ground in the simulation or not

aggregation.func

Function specifying how to deal with voxels in overlapping crowns (that belong to more than one tree): Either the maximum, sum, mean or minimum of all different values for that voxel can be taken, or if set to NA the values do not get aggregated, thus multiple rows for that voxel are kept in the final voxelforest output. Aggregation can only be performed if no additional columns should be kept, to avoid ambiguities. If the parameter keep is set to something other than NA, it has priority and aggregation is suppressed.

keep

Optional vector of column names from which information should be kept in each voxel of the output. E.g. choose keep=c("X", "Y", "TreeID") if stem positions and ID of each tree should be available for each voxel. X and Y are special cases, because in the output the columns "X" and "Y" specify the voxel coordinates. Thus, the columns containing the stem coordinates are renamed to "Xstem" and "Ystem". Other kept columns will appear in the output under their original input name.

run.parallel

boolean to specify whether to use parallelization or not

frac.cores

fraction of available cores to use for parallelization

res

resolution (side length) of the parallelized subunits

Value

data.table object containing a XYZ-table of tree crown voxels, ground voxels and maybe tree stem voxels

Author(s)

Nikolai Knapp

Examples

in progress

niknap/slidaRtools documentation built on Oct. 16, 2024, 3:53 p.m.