The following examples demonstrates how to use the
artificial_stand function of
rTLS package to simulate potential stands based on tree point clouds.
In general, the scanning of a plot using TLS is a time-consuming work that usually requires several people and steps to achieve a quality product. In studies where plots are the sample units, the scanning of several plots is a considerable challenge to answer specific questions. The idea behind
artificial_stand is to provide a general overview of artificial stands that can be created and modified by users; allowing us to recreate potential scenarios of the spatial variation of the forest structure. To archive this, users can select several arguments related to the number of tree point clouds to use, the future coordinates of the trees in the stands, or the plot size, to mention some.
artificial_stand function is focused on tree point clouds, users should first define the location of point clouds files to use. This needs to be a vector defining the their names and where the files are located if these are not in the working directory. These files may have any ASCII format and these will be read it in
artificial_stand using the
fread function of
data.table. You could define the specific delimited format of the files using the
... argument passed to
As an example, here we will use a tree point cloud already embedded in
pc_tree.txt. This file is located in the extdata of
library(rTLS) <- system.file("extdata", "pc_tree.txt", package = "rTLS")path
The structure of the location vector should be similar than
path depending on the number and identify of point clouds for the future artificial stand. For example, if the user wants a stand with four different tree, the
path vector should have paths for four different files. On the other hand, if the user wants a stand with four trees regardless their identity, the user can set the argument
sample = TRUE in order to use the same path four different times. Users can also select the argument
replace = TRUE in order to do a sample selection with replacement in scenarios when you have more paths than the number of trees required.
In order to select the plot size of the future artificial stands users can use the argument
dimension. This need to be a vector of length two defining the width and length of the plot. It is expected that the unit scale of the point could files match with the unit scale for plot. An example for an hectare plot could be:
<- c(100, 100)plot_size
Then the number of trees for the future stand may depends on the arguments previously described in the selection of files. For this example, let’s assume that we want to create a stand of 10 trees using the same point cloud. This can be done following
n.trees = 10.
The location of these trees in the future artificial stand could be random or could be previously defined. In order to provide random coordinates to the trees in the future stands we most use
coordinates = NULL. On the other hand, if we want to provide specific coordinates we should add a
data.table of two columns and with equal to describing the basal XYZ coordinates of the point clouds in the future stand.
#Number of trees <- 10 trees #Random coordinates <- NULL coor_1 #Predefined coordinates <- data.table(X = c(10, 10, 30, 30, 50, 50, 70, 70, 90, 90), Y = c(25, 75, 25, 75, 25, 75, 25, 75, 25, 75))coor_2
Users should define other arguments related with the potential overlap of crowns if they use random coordinates using the
overlap argument. In addition, user should also define if they want a random or specific rotation angles in the yaw axis of the point cloud. If the users wants a specific angle of rotation in their point clouds these need to be defined in the degrees argument using vector describing the degrees of rotation. An example of all of this could be:
# 5% of overlaping between crowns <- 5 overl # Trees without rotation <- FALSE rota_1 # Trees with random rotation <- FALSE rota_2 <- NULL degreess_1 # Trees with rotation and specific angles <- FALSE rota_3 <- seq(0, 360, length.out = 10)degreess_2
Once users have selected their arguments related to the point cloud paths, number of trees, plot size, and tree coordinates it is possible to run
artifical_stands. Following our example of 10 trees using the same point cloud in an hectare plot we should have the following:
# A total random artifical stand <- artificial_stand(path, n.trees = trees, dimension = plot_size, coordinates = coor_1, overlap = overl, sample = TRUE, replace = TRUE) stand_1 # An artifical stand with defined tree coordinates and random tree rotation <- artificial_stand(path, n.trees = trees, dimension = plot_size, coordinates = coor_2, sample = TRUE, replace = TRUE, rotation = rota_2, degrees = degreess_1) stand_2 # An artifical stand with defined tree coordinates and defined tree rotation <- artificial_stand(path, n.trees = trees, dimension = plot_size, coordinates = coor_2, sample = TRUE, replace = TRUE, rotation = rota_3, degrees = degreess_2) stand_3 # An artifical stand with defined tree coordinates and without tree rotation <- artificial_stand(path, n.trees = trees, dimension = plot_size, coordinates = coor_2, sample = TRUE, replace = TRUE, rotation = FALSE)stand_4
The resulting output of this function is a list that contains: