Title: | Calculate Wood Volumes from Taper Functions |
Version: | 2.0.1 |
Description: | Functions for estimation of wood volumes, number of logs, diameters along the stem and heights at which certain diameters occur, based on taper functions and other parameters. References: McTague, J. P., & Weiskittel, A. (2021). <doi:10.1139/cjfr-2020-0326>. |
Depends: | R(≥ 3.3) |
Imports: | dplyr, ggplot2, cowplot, tidyr, tibble, magrittr, miniUI, shiny |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.2 |
Suggests: | rmarkdown, knitr, minpack.lm, purrr |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2022-04-06 15:03:32 UTC; sergio.costa |
Author: | Sergio Costa |
Maintainer: | Sergio Costa <sergio.vscf@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2022-04-11 14:10:02 UTC |
Pipe operator
Description
See magrittr::%>%
for details.
Usage
lhs %>% rhs
Arguments
lhs |
A value or the magrittr placeholder. |
rhs |
A function call using the magrittr semantics. |
Value
The result of calling rhs(lhs)
.
Estimate the diameter at a given height based on a fitted Bi (2000) taper equation.
Description
Estimates the diameter at a given height of a tree from the diameter at breast height, total height and the coefficients of the Bi taper function.
Usage
bi_di(dbh, h, hi, coef)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
hi |
height at which the diameter will be calculated, in meters. |
coef |
numerical vector containing seven coefficients of the Bi taper function. |
Details
the Bi (2000) variable-form taper function is represented mathematically by the following expression
di ~ dbh * (log(sin((pi/2) * (hi/h)))/(log(sin((pi/2) * (1.3/h)))))^(b0 + b1 * sin((pi/2) * (hi/h)) + b2 * cos((3 * pi/2) * (hi/h)) + b3 * (sin((pi/2) * (hi/h))/(hi/h)) + b4 * dbh + b5 * (hi/h) * dbh^0.5 + b6 * (hi/h) * h^0.5)
Value
a numeric value indicating the diameter at the given height.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
bi <- nlsLM(di ~ taper_bi(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6),
data=tree_scaling,
start=list(b0=1.8,b1=-0.2,b2=-0.04,b3=-0.9,b4=-0.0006,b5=0.07,b6=-.14))
coef_bi <- coef(bi)
dbh <- 25
h <- 20
hi <- 15
bi_di(dbh, h, hi, coef_bi)
Estimate the height at which a given diameter occurs in a tree, based on a fitted Bi (2000) taper equation.
Description
Estimates the height at which a given diameter occurs in a tree, from the diameter at breast height, total height and coefficients of the Bi taper function.
Usage
bi_hi(dbh, h, di, coef)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
di |
diameter whose height of occurrence will be estimated, in centimeters. |
coef |
numerical vector containing seven coefficients of the Bi taper equation |
Details
the Bi (2000) variable-form taper function is represented mathematically by the following expression
di ~ dbh * (log(sin((pi/2) * (hi/h)))/(log(sin((pi/2) * (1.3/h)))))^(b0 + b1 * sin((pi/2) * (hi/h)) + b2 * cos((3 * pi/2) * (hi/h)) + b3 * (sin((pi/2) * (hi/h))/(hi/h)) + b4 * dbh + b5 * (hi/h) * dbh^0.5 + b6 * (hi/h) * h^0.5)
Value
a numeric value indicating the height at which the given diameter occurs.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
bi <- nlsLM(di ~ taper_bi(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6),
data=tree_scaling,
start=list(b0=1.8,b1=-0.2,b2=-0.04,b3=-0.9,b4=-0.0006,b5=0.07,b6=-.14))
coef_bi <- coef(bi)
dbh <- 25
h <- 20
di <- 5
bi_hi(dbh, h, di, coef_bi)
Simulate log extraction using a Bi (2000) variable-form taper equation that describes the taper of the tree.
Description
Simulate the extraction of logs from a tree from its measurements, taper function (Bi (2000) variable-form taper equation ), trunk quality characteristics and harvest parameters such as stump height and assortments.
Usage
bi_logs(
dbh,
h,
coef,
assortments,
stump_height,
downgrade,
broken,
defect_height,
eliminate,
total_volume,
only_vol
)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
coef |
numerical vector containing seven coefficients of the Bi taper equation. |
assortments |
a data.frame with five columns and n rows, where n is the number of different wood assortments to be obtained from the tree stem. The first column must contain the names of the assortments, the second, numerical, contains the minimum diameters at the small end of the logs, in centimeters. The third column, numerical, contains the minimum lengths of the logs, in meters. The fourth column, numerical, contains the maximum lengths of the logs, in meters. The fifth column, numerical, contains the values in centimeters referring to the loss of wood due to cutting logs. The algorithm prioritizes the extraction of assortments along the stem in the order presented in the data.frame, starting from the first line, to the last. |
stump_height |
tree cutting height, in meters. Default is 0. |
downgrade |
if TRUE, the algorithm,from the defect_height onwards, simulates log extraction only for the last assortment in the assortments data.frame. Default is FALSE. |
broken |
if TRUE, the algorithm will simulate the extraction of logs only up to the defect_height. Default is FALSE. |
defect_height |
the height, in meters, from which the logs will be downgraded (if downgrade is TRUE) or log extraction simulation will be stopped (if broken is TRUE). Default is 0 for downgrade = TRUE (the whole tree is downgraded) and h * 0.5 for broken = TRUE (the tree is broken from half its original/estimated total height). |
eliminate |
if TRUE, the algorithm does not get logs for any assortment present in the assortments table. All will be zero. Default is FALSE. |
total_volume |
if TRUE, it adds an additional column to the results data.frame with the estimate of the total volume of the tree, from the ground height to h if broken argument is FALSE, or to defect_height if broken is TRUE. Default is FALSE. |
only_vol |
if TRUE returns only volumes (does not return the number of logs). Default is FALSE. |
Details
when the broken
and downgrade
arguments are set to TRUE, the defect_height
value is considered as the break height of the tree, and the entire tree is downgraded.
Value
a list of two data.frames, the first (volumes) with the calculated volumes per assortment, and the second (logs) with the number of logs per assortment.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
bi <- nlsLM(di ~ taper_bi(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6),
data=tree_scaling,
start=list(b0=1.8,b1=-0.2,b2=-0.04,b3=-0.9,b4=-0.0006,b5=0.07,b6=-.14))
coef_bi <- coef(bi)
dbh <- 25
h <- 20
assortments <- data.frame(
NAME = c('15-25','4-15'),
SED = c(15,4),
MINLENGTH = c(2.65,2),
MAXLENGTH = c(2.65,4.2),
LOSS = c(5,5)
)
bi_logs(dbh, h, coef_bi, assortments)
Visualize the simulation of log cutting along the stem using a Bi (2000) variable-form taper equation.
Description
Plot the shape of the tree and visualize the extracted logs based on the tree measurements, assortments data.frame, and the Bi (2000) variable-form taper equation.
Usage
bi_logs_plot(
dbh,
h,
coef,
assortments,
stump_height,
downgrade,
broken,
defect_height,
lang
)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
coef |
numerical vector containing seven coefficients of the Bi variable-form taper equation. |
assortments |
a data.frame with five columns and n rows, where n is the number of different wood assortments to be obtained from the tree stem. The first column must contain the names of the assortments, the second, numerical, contains the minimum diameters at the small end of the logs, in centimeters. The third column, numerical, contains the minimum lengths of the logs, in meters. The fourth column, numerical, contains the maximum lengths of the logs, in meters. The fifth column, numerical, contains the values in centimeters referring to the loss of wood due to cutting logs. The algorithm prioritizes the extraction of assortments along the stem in the order presented in the data.frame, starting from the first line, to the last. |
stump_height |
tree cutting height, in meters. Default is 0. |
downgrade |
if TRUE, the algorithm,from the defect_height onwards, simulates log extraction only for the last assortment in the assortments data.frame. Default is FALSE. |
broken |
if TRUE, the algorithm will simulate the extraction of logs only up to the defect_height. Default is FALSE. |
defect_height |
the height, in meters, from which the logs will be downgraded (if downgrade is TRUE) or log extraction simulation will be stopped (if broken is TRUE). Default is h * 0.5. |
lang |
language in which plot labels will be displayed. Current options are 'en' and 'pt-BR'. Default is 'en'. |
Details
check the bi_logs
function help for more details.
Value
a ggplot object.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
bi <- nlsLM(di ~ taper_bi(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6),
data=tree_scaling,
start=list(b0=1.8,b1=-0.2,b2=-0.04,b3=-0.9,b4=-0.0006,b5=0.07,b6=-.14))
coef_bi <- coef(bi)
dbh <- 25
h <- 20
assortments <- data.frame(
NAME = c('15-25','4-15'),
SED = c(15,4),
MINLENGTH = c(2.65,2),
MAXLENGTH = c(2.65,4.2),
LOSS = c(5,5)
)
bi_logs_plot(dbh, h, coef_bi, assortments)
Estimate the total or partial volume of the tree, based on a fitted Bi (2000) taper function.
Description
Estimates the total or partial volume of the tree from the diameter at breast height, total height, initial section height, final section height and coefficients of the Bi (2000) taper equation.
Usage
bi_vol(dbh, h, coef, hi, h0)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
coef |
numerical vector containing seven coefficients of the Bi taper equation. |
hi |
final height of the tree section whose volume will be calculated, in meters. Default is the total tree height (h). |
h0 |
initial height of the tree section whose volume will be calculated, in meters. Default is 0 (ground height). |
Details
the Bi (2000) variable-form taper function is represented mathematically by the following expression
di ~ dbh * (log(sin((pi/2) * (hi/h)))/(log(sin((pi/2) * (1.3/h)))))^(b0 + b1 * sin((pi/2) * (hi/h)) + b2 * cos((3 * pi/2) * (hi/h)) + b3 * (sin((pi/2) * (hi/h))/(hi/h)) + b4 * dbh + b5 * (hi/h) * dbh^0.5 + b6 * (hi/h) * h^0.5)
Value
a numeric value indicating the total or partial volume of the tree.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
bi <- nlsLM(di ~ taper_bi(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6),
data=tree_scaling,
start=list(b0=1.8,b1=-0.2,b2=-0.04,b3=-0.9,b4=-0.0006,b5=0.07,b6=-.14))
coef_bi <- coef(bi)
dbh <- 25
h <- 20
bi_vol(dbh, h, coef_bi)
hi = 15
h0 = .2
bi_vol(dbh, h, coef_bi, hi, h0)
Estimate the diameter at a given height based on a fitted Kozak (2004) taper equation.
Description
Estimates the diameter at a given height of a tree from the diameter at breast height, total height and the coefficients of the Kozak (2004) taper function.
Usage
kozak_di(dbh, h, hi, coef, p)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
hi |
height at which the diameter will be calculated, in meters. |
coef |
numerical vector containing nine coefficients of the Kozak taper function. |
p |
numerical value representing the first inflection point calculated in the segmented model of Max and Burkhart (1976). |
Details
the Kozak (2004) variable-form taper function is represented mathematically by the following expression
di ~b0*(dbh^b1)(h^b2)((1-(hi/h)^(1/4))/(1-(p^(1/3))))^(b3*(hi/h)^4+b4*(1/exp(dbh/h))+b5*((1-(hi/h)^(1/4))/(1-(p^(1/3))))^0.1+b6*(1/dbh)+b7*(h^(1-(hi/h)^(1/3)))+b8*((1-(hi/h)^(1/4))/(1-(p^(1/3)))))
Value
a numeric value indicating the diameter at the given height.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
kozak <- nlsLM(di ~ taper_kozak(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, p),
start=list(b0=1.00,b1=.97,b2=.03,b3=.49,b4=-
0.87,b5=0.50,b6=3.88,b7=0.03,b8=-0.19, p = .1),
data = tree_scaling,
control = nls.lm.control(maxiter = 1000, maxfev = 2000)
)
coef_kozak <- coef(kozak)[-10]
p_kozak <- coef(kozak)[10]
h <- 20
dbh <- 25
di <- 5
kozak_di(dbh, h, di, coef_kozak, p_kozak)
Estimate the height at which a given diameter occurs in a tree, based on a fitted Kozak (2004) taper equation.
Description
Estimates the height at which a given diameter occurs in a tree, from the diameter at breast height, total height and coefficients of the Kozak (2004) taper function.
Usage
kozak_hi(dbh, h, di, coef, p)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
di |
diameter whose height of occurrence will be estimated, in centimeters. |
coef |
numerical vector containing nine coefficients of the Kozak taper equation |
p |
numerical value representing the first inflection point calculated in the segmented model of Max and Burkhart (1976). |
Details
the Kozak (2004) variable-form taper function is represented mathematically by the following expression
di ~b0*(dbh^b1)(h^b2)((1-(hi/h)^(1/4))/(1-(p^(1/3))))^(b3*(hi/h)^4+b4*(1/exp(dbh/h))+b5*((1-(hi/h)^(1/4))/(1-(p^(1/3))))^0.1+b6*(1/dbh)+b7*(h^(1-(hi/h)^(1/3)))+b8*((1-(hi/h)^(1/4))/(1-(p^(1/3)))))
Value
as numeric value indicating the height at which the given diameter occurs.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
kozak <- nlsLM(di ~ taper_kozak(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, p),
start=list(b0=1.00,b1=.97,b2=.03,b3=.49,b4=-
0.87,b5=0.50,b6=3.88,b7=0.03,b8=-0.19, p = .1),
data = tree_scaling,
control = nls.lm.control(maxiter = 1000, maxfev = 2000)
)
coef_kozak <- coef(kozak)[-10]
p_kozak <- coef(kozak)[10]
h <- 20
dbh <- 25
hi <- 15
kozak_hi(dbh, h, hi, coef_kozak, p_kozak)
Simulate log extraction using a Kozak (2004) variable-form taper equation that describes the taper of the tree.
Description
Simulate the extraction of logs from a tree from its measurements, taper function (Kozak (2004) variable-form taper equation ), trunk quality characteristics and harvest parameters such as stump height and assortments.
Usage
kozak_logs(
dbh,
h,
coef,
p,
assortments,
stump_height,
downgrade,
broken,
defect_height,
eliminate,
total_volume,
only_vol
)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
coef |
numerical vector containing nine coefficients of the Kozak taper equation. |
p |
numerical value representing the first inflection point calculated in the segmented model of Max and Burkhart (1976). |
assortments |
a data.frame with five columns and n rows, where n is the number of different wood assortments to be obtained from the tree stem. The first column must contain the names of the assortments, the second, numerical, contains the minimum diameters at the small end of the logs, in centimeters. The third column, numerical, contains the minimum lengths of the logs, in meters. The fourth column, numerical, contains the maximum lengths of the logs, in meters. The fifth column, numerical, contains the values in centimeters referring to the loss of wood due to cutting logs. The algorithm prioritizes the extraction of assortments along the stem in the order presented in the data.frame, starting from the first line, to the last. |
stump_height |
tree cutting height, in meters. Default is 0. |
downgrade |
if TRUE, the algorithm,from the defect_height onwards, simulates log extraction only for the last assortment in the assortments data.frame. Default is FALSE. |
broken |
if TRUE, the algorithm will simulate the extraction of logs only up to the defect_height. Default is FALSE. |
defect_height |
the height, in meters, from which the logs will be downgraded (if downgrade is TRUE) or log extraction simulation will be stopped (if broken is TRUE). Default is 0 for downgrade = TRUE (the whole tree is downgraded) and h * 0.5 for broken = TRUE (the tree is broken from half its original/estimated total height). |
eliminate |
if TRUE, the algorithm does not get logs for any assortment present in the assortments table. All will be zero. Default is FALSE. |
total_volume |
if TRUE, it adds an additional column to the results data.frame with the estimate of the total volume of the tree, from the ground height to h if broken argument is FALSE, or to defect_height if broken is TRUE. Default is FALSE. |
only_vol |
if TRUE returns only volumes (does not return the number of logs). Default is FALSE. |
Details
when the broken
and downgrade
arguments are set to TRUE, the defect_height
value is considered as the break height of the tree, and the entire tree is downgraded.
Value
a list of two data.frames, the first (volumes) with the calculated volumes per assortment, and the second (logs) with the number of logs per assortment.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
kozak <- nlsLM(di ~ taper_kozak(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, p),
start=list(b0=1.00,b1=.97,b2=.03,b3=.49,b4=-
0.87,b5=0.50,b6=3.88,b7=0.03,b8=-0.19, p = .1),
data = tree_scaling,
control = nls.lm.control(maxiter = 1000, maxfev = 2000)
)
coef_kozak <- coef(kozak)[-10]
p_kozak <- coef(kozak)[10]
h <- 20
dbh <- 25
assortments <- data.frame(
NAME = c('15-25','4-15'),
SED = c(15,4),
MINLENGTH = c(2.65,2),
MAXLENGTH = c(2.65,4.2),
LOSS = c(5,5)
)
kozak_logs(dbh, h, coef_kozak, p_kozak, assortments)
Visualize the simulation of log cutting along the stem using a Kozak (2004) variable-form taper equation.
Description
Plot the shape of the tree and visualize the extracted logs based on the tree measurements, assortments data.frame, and the Kozak (2004) variable-form taper equation.
Usage
kozak_logs_plot(
dbh,
h,
coef,
p,
assortments,
stump_height,
downgrade,
broken,
defect_height,
lang
)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
coef |
numerical vector containing seven coefficients of the Kozak variable-form taper equation. |
p |
numerical value representing the first inflection point calculated in the segmented model of Max and Burkhart (1976). |
assortments |
a data.frame with five columns and n rows, where n is the number of different wood assortments to be obtained from the tree stem. The first column must contain the names of the assortments, the second, numerical, contains the minimum diameters at the small end of the logs, in centimeters. The third column, numerical, contains the minimum lengths of the logs, in meters. The fourth column, numerical, contains the maximum lengths of the logs, in meters. The fifth column, numerical, contains the values in centimeters referring to the loss of wood due to cutting logs. The algorithm prioritizes the extraction of assortments along the stem in the order presented in the data.frame, starting from the first line, to the last. |
stump_height |
tree cutting height, in meters. Default is 0. |
downgrade |
if TRUE, the algorithm,from the defect_height onwards, simulates log extraction only for the last assortment in the assortments data.frame. Default is FALSE. |
broken |
if TRUE, the algorithm will simulate the extraction of logs only up to the defect_height. Default is FALSE. |
defect_height |
the height, in meters, from which the logs will be downgraded (if downgrade is TRUE) or log extraction simulation will be stopped (if broken is TRUE). Default is h * 0.5. |
lang |
language in which plot labels will be displayed. Current options are 'en' and 'pt-BR'. Default is 'en'. |
Details
check the kozak_logs
function help for more details.
Value
a ggplot object.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
kozak <- nlsLM(di ~ taper_kozak(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, p),
start=list(b0=1.00,b1=.97,b2=.03,b3=.49,b4=-
0.87,b5=0.50,b6=3.88,b7=0.03,b8=-0.19, p = .1),
data = tree_scaling,
control = nls.lm.control(maxiter = 1000, maxfev = 2000)
)
coef_kozak <- coef(kozak)[-10]
p_kozak <- coef(kozak)[10]
h <- 20
dbh <- 25
assortments <- data.frame(
NAME = c('15-25','4-15'),
SED = c(15,4),
MINLENGTH = c(2.65,2),
MAXLENGTH = c(2.65,4.2),
LOSS = c(5,5)
)
kozak_logs(dbh, h, coef_kozak, p_kozak, assortments)
Estimate the total or partial volume of the tree, based on a fitted Kozak (2004) taper function.
Description
Estimates the total or partial volume of the tree from the diameter at breast height, total height, initial section height, final section height and coefficients of the Kozak (2004) taper equation.
Usage
kozak_vol(dbh, h, coef, p, hi, h0)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
coef |
numerical vector containing eight coefficients of the Kozak taper equation. |
p |
numerical value representing the first inflection point calculated in the segmented model of Max and Burkhart (1976). |
hi |
final height of the tree section whose volume will be calculated, in meters. Default is the total tree height (h). |
h0 |
initial height of the tree section whose volume will be calculated, in meters. Default is 0 (ground height). |
Details
the Kozak (2004) variable-form taper function is represented mathematically by the following expression
di ~ b0*(dbh^b1)(h^b2)((1-(hi/h)^(1/4))/(1-(p^(1/3))))^(b3*(hi/h)^4+b4*(1/exp(dbh/h))+b5*((1-(hi/h)^(1/4))/(1-(p^(1/3))))^0.1+b6*(1/dbh)+b7*(h^(1-(hi/h)^(1/3)))+b8*((1-(hi/h)^(1/4))/(1-(p^(1/3)))))
Value
a numeric value indicating the total or partial volume of the tree.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
kozak <- nlsLM(di ~ taper_kozak(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, p),
start=list(b0=1.00,b1=.97,b2=.03,b3=.49,b4=-
0.87,b5=0.50,b6=3.88,b7=0.03,b8=-0.19, p = .1),
data = tree_scaling,
control = nls.lm.control(maxiter = 1000, maxfev = 2000)
)
coef_kozak <- coef(kozak)[-10]
p_kozak <- coef(kozak)[10]
h <- 20
dbh <- 25
di <- 5
kozak_vol(dbh, h, coef_kozak, p_kozak)
hi = 15
h0 = .2
kozak_vol(dbh, h, coef_kozak, p_kozak, hi, h0)
Estimate the diameter at a given height based on a 5th degree polynomial function.
Description
Estimates the diameter at a given height of a tree from the diameter at breast height, total height and the coefficients of the 5th degree polynomial function that describes the tree's taper.
Usage
poly5_di(dbh, h, hi, coef)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
hi |
height at which the diameter will be calculated, in meters. |
coef |
numerical vector containing six coefficients of the 5th degree polynomial function that describes the tree's taper. |
Value
a numeric value indicating the diameter at the given height.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
poli5 <- lm(did~hih+I(hih^2)+I(hih^3)+I(hih^4)+I(hih^5),tree_scaling)
coef_poli <- coef(poli5)
dbh <- 25
h <- 20
di <- 5
poly5_di(dbh, h, di, coef_poli)
Estimate the height at which a given diameter occurs in a tree, based on a 5th degree polynomial function.
Description
Estimates the height at which a given diameter occurs in a tree, from the diameter at breast height, total height and coefficients of the 5th degree polynomial function that describes the tree's taper.
Usage
poly5_hi(dbh, h, di, coef)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
di |
diameter whose height of occurrence will be estimated, in centimeters. |
coef |
numerical vector containing six coefficients of the 5th degree polynomial function that describes the tree's taper. |
Value
as numeric value indicating the height at which the given diameter occurs.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
poli5 <- lm(did~hih+I(hih^2)+I(hih^3)+I(hih^4)+I(hih^5),tree_scaling)
coef_poli <- coef(poli5)
dbh <- 25
h <- 20
hi <- 15
poly5_hi(dbh, h, hi, coef_poli)
Simulate log extraction using a 5th degree polynomial that describes the taper of the tree.
Description
Simulate the extraction of logs from a tree from its measurements, taper function (5th degree polynomial), trunk quality characteristics and harvest parameters such as stump height and assortments.
Usage
poly5_logs(
dbh,
h,
coef,
assortments,
stump_height,
downgrade,
broken,
defect_height,
eliminate,
total_volume,
only_vol
)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
coef |
numerical vector containing six coefficients of the 5th degree polynomial function that describes the tree's taper. |
assortments |
a data.frame with five columns and n rows, where n is the number of different wood assortments to be obtained from the tree stem. The first column must contain the names of the assortments, the second, numerical, contains the minimum diameters at the small end of the logs, in centimeters. The third column, numerical, contains the minimum lengths of the logs, in meters. The fourth column, numerical, contains the maximum lengths of the logs, in meters. The fifth column, numerical, contains the values in centimeters referring to the loss of wood due to cutting logs. The algorithm prioritizes the extraction of assortments along the stem in the order presented in the data.frame, starting from the first line, to the last. |
stump_height |
tree cutting height, in meters. Default is 0. |
downgrade |
if TRUE, the algorithm,from the defect_height onwards, simulates log extraction only for the last assortment in the assortments data.frame. Default is FALSE. |
broken |
if TRUE, the algorithm will simulate the extraction of logs only up to the defect_height. Default is FALSE. |
defect_height |
the height, in meters, from which the logs will be downgraded (if downgrade is TRUE) or log extraction simulation will be stopped (if broken is TRUE). Default is 0 for downgrade = TRUE (the whole tree is downgraded) and h * 0.5 for broken = TRUE (the tree is broken from half its original/estimated total height). |
eliminate |
if TRUE, the algorithm does not get logs for any assortment present in the assortments table. All will be zero. Default is FALSE. |
total_volume |
if TRUE, it adds an additional column to the results data.frame with the estimate of the total volume of the tree, from the ground height to h if broken argument is FALSE, or to defect_height if broken is TRUE. Default is FALSE. |
only_vol |
if TRUE returns only volumes (does not return the number of logs). Default is FALSE. |
Details
when the broken
and downgrade
arguments are set to TRUE, the defect_height
value is considered as the break height of the tree, and the entire tree is downgraded.
Value
a list of two data.frames, the first (volumes) with the calculated volumes per assortment, and the second (logs) with the number of logs per assortment.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
poli5 <- lm(did~hih+I(hih^2)+I(hih^3)+I(hih^4)+I(hih^5),tree_scaling)
coef_poli <- coef(poli5)
dbh <- 25
h <- 20
assortments <- data.frame(
NAME = c('15-25','4-15'),
SED = c(15,4),
MINLENGTH = c(2.65,2),
MAXLENGTH = c(2.65,4.2),
LOSS = c(5,5)
)
poly5_logs(dbh, h, coef_poli, assortments)
Visualize the simulation of log cutting along the stem using a 5th degree polynomial that describes the tree taper.
Description
Plot the shape of the tree and visualize the extracted logs based on the tree measurements, assortments data.frame, and the 5th degree polynomial function that describes the tree's taper.
Usage
poly5_logs_plot(
dbh,
h,
coef,
assortments,
stump_height,
downgrade,
broken,
defect_height,
lang
)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
coef |
numerical vector containing six coefficients of the 5th degree polynomial function that describes the tree's taper. |
assortments |
a data.frame with five columns and n rows, where n is the number of different wood assortments to be obtained from the tree stem. The first column must contain the names of the assortments, the second, numerical, contains the minimum diameters at the small end of the logs, in centimeters. The third column, numerical, contains the minimum lengths of the logs, in meters. The fourth column, numerical, contains the maximum lengths of the logs, in meters. The fifth column, numerical, contains the values in centimeters referring to the loss of wood due to cutting logs. The algorithm prioritizes the extraction of assortments along the stem in the order presented in the data.frame, starting from the first line, to the last. |
stump_height |
tree cutting height, in meters. Default is 0. |
downgrade |
if TRUE, the algorithm,from the defect_height onwards, simulates log extraction only for the last assortment in the assortments data.frame. Default is FALSE. |
broken |
if TRUE, the algorithm will simulate the extraction of logs only up to the defect_height. Default is FALSE. |
defect_height |
the height, in meters, from which the logs will be downgraded (if downgrade is TRUE) or log extraction simulation will be stopped (if broken is TRUE). Default is h * 0.5. |
lang |
language in which plot labels will be displayed. Current options are 'en' and 'pt-BR'. Default is 'en'. |
Details
check the poly5_logs
function help for more details.
Value
a ggplot object.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
poli5 <- lm(did~hih+I(hih^2)+I(hih^3)+I(hih^4)+I(hih^5),tree_scaling)
coef_poli <- coef(poli5)
dbh <- 25
h <- 20
assortments <- data.frame(
NAME = c('15-25','4-15'),
SED = c(15,4),
MINLENGTH = c(2.65,2),
MAXLENGTH = c(2.65,4.2),
LOSS = c(5,5)
)
poly5_logs_plot(dbh, h, coef_poli, assortments)
Estimate the total or partial volume of the tree, based on a 5th degree polynomial function that describes the taper of the tree.
Description
Estimates the total or partial volume of the tree from the diameter at breast height, total height, initial section height, final section height and coefficients of the 5th degree polynomial function that describes the tree's taper.
Usage
poly5_vol(dbh, h, coef, hi, h0)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
coef |
numerical vector containing six coefficients of the 5th degree polynomial function that describes the tree's taper. |
hi |
final height of the tree section whose volume will be calculated, in meters. Default is the total tree height (h). |
h0 |
initial height of the tree section whose volume will be calculated, in meters. Default is 0 (ground height). |
Value
a numeric value indicating the total or partial volume of the tree.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
poli5 <- lm(did~hih+I(hih^2)+I(hih^3)+I(hih^4)+I(hih^5),tree_scaling)
coef_poli <- coef(poli5)
dbh <- 25
h <- 20
poly5_vol(dbh, h, coef_poli)
hi = 15
h0 = .2
poly5_vol(dbh, h, coef_poli, hi, h0)
Remove unwanted data by selecting it
Description
Delete unwanted records from the dataset (e.g. outliers) by selecting them in a scatter plot.
Usage
select_and_remove(data, xvar, yvar)
Arguments
data |
a data.frame. |
xvar |
quoted name of the variable to be displayed in the x axis. |
yvar |
quoted name of the variable to be displayed in the y axis. |
Value
the data.frame given to the data
argument, without the selected points.
Examples
## Not run:
library(dplyr)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h) %>%
select_and_remove(., 'hih', 'did')
## End(Not run)
Bi (2004) Taper Function.
Description
Bi (2004) Taper Function.
Usage
taper_bi(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
hih |
ratio between the height of the section (hi) and the total height (h) . |
b0 , b1 , b2 , b3 , b4 , b5 , b6 |
model parameters. |
Value
a numeric value indicating the diameter at the section.
References
Bi, H. (2000). Trigonometric variable-form taper equations for Australian eucalypts. Forest Science, 46(3), 397-409.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
bi <- nlsLM(di ~ taper_bi(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6),
data=tree_scaling,
start=list(b0=1.8,b1=-0.2,b2=-0.04,b3=-0.9,b4=-0.0006,b5=0.07,b6=-.14))
Kozak (2004) Taper Function.
Description
Kozak (2004) Taper Function.
Usage
taper_kozak(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, p)
Arguments
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
hih |
ratio between the height of the section (hi) and the total height (h) . |
b0 , b1 , b2 , b3 , b4 , b5 , b6 , b7 , b8 |
model parameters. |
p |
numerical value representing the first inflection point calculated in the segmented model of Max and Burkhart (1976). |
Value
a numeric value indicating the diameter at the section.
References
Kozak, A. (2004). My last words on taper equations. The Forestry Chronicle, 80(4), 507-515.
Examples
library(dplyr)
library(minpack.lm)
library(timbeR)
tree_scaling <- tree_scaling %>%
mutate(did = di/dbh,
hih = hi/h)
kozak <- nlsLM(di ~ taper_kozak(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, p),
data=tree_scaling,
start=list(b0=1.00,b1=.97,b2=.03,b3=.49,b4=-0.87,b5=0.50,b6=3.88,b7=0.03,b8=-0.19,p =.1))
Tree scaling example data
Description
Diameter (cm) and height (m) measurements along the bole of 8 Pinus taeda trees.
Usage
data(tree_scaling)
Format
A data frame with 136 rows and 5 variables:
- tree_id
tree unique id
- dbh
diameter at breast height, in centimeters
- h
total tree height, in meters
- hi
tree section height, in meters
- di
diameter at the tree section, in centimeters