Title: | Calculate Wood Volumes from Taper Functions |
---|---|
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>. |
Authors: | Sergio Costa [aut, cre, cph] |
Maintainer: | Sergio Costa <[email protected]> |
License: | MIT + file LICENSE |
Version: | 2.0.1 |
Built: | 2025-02-12 18:41:25 UTC |
Source: | https://github.com/sergiocostafh/timber |
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.
bi_di(dbh, h, hi, coef)
bi_di(dbh, h, hi, coef)
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. |
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)
a numeric value indicating the diameter at the given height.
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)
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)
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.
bi_hi(dbh, h, di, coef)
bi_hi(dbh, h, di, coef)
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 |
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)
a numeric value indicating the height at which the given diameter occurs.
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)
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 the cutting 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.
bi_logs( dbh, h, coef, assortments, stump_height, downgrade, broken, defect_height, eliminate, total_volume, only_vol )
bi_logs( dbh, h, coef, assortments, stump_height, downgrade, broken, defect_height, eliminate, total_volume, only_vol )
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. |
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.
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.
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)
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)
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.
bi_logs_plot( dbh, h, coef, assortments, stump_height, downgrade, broken, defect_height, lang )
bi_logs_plot( dbh, h, coef, assortments, stump_height, downgrade, broken, defect_height, lang )
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'. |
check the bi_logs
function help for more details.
a ggplot object.
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)
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)
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.
bi_vol(dbh, h, coef, hi, h0)
bi_vol(dbh, h, coef, hi, h0)
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). |
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)
a numeric value indicating the total or partial volume of the tree.
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)
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)
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.
kozak.04_di(dbh, h, hi, coef, p)
kozak.04_di(dbh, h, hi, coef, p)
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). |
the Kozak (2004) variable-form taper function is represented mathematically by the following expression
di ~b0*(dbh^b1)(h^b2)((1-(hi/h)^(1/3))/(1-(p^(1/3))))^(b3*(hi/h)^4+b4*(1/exp(dbh/h))+b5*((1-(hi/h)^(1/3))/(1-(p^(1/3))))^0.1+b6*(1/dbh)+b7*(h^(1-(hi/h)^(1/3)))+b8*((1-(hi/h)^(1/3))/(1-(p^(1/3)))))
a numeric value indicating the diameter at the given height.
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.04 <- nlsLM(di ~ taper_kozak.04(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.04 <- coef(kozak.04)[-10] p_kozak.04 <- coef(kozak.04)[10] h <- 20 dbh <- 25 di <- 5 kozak.04_di(dbh, h, di, coef_kozak.04, p_kozak.04)
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.04 <- nlsLM(di ~ taper_kozak.04(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.04 <- coef(kozak.04)[-10] p_kozak.04 <- coef(kozak.04)[10] h <- 20 dbh <- 25 di <- 5 kozak.04_di(dbh, h, di, coef_kozak.04, p_kozak.04)
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.
kozak.04_hi(dbh, h, di, coef, p)
kozak.04_hi(dbh, h, di, coef, p)
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). |
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)))))
as numeric value indicating the height at which the given diameter occurs.
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.04 <- nlsLM(di ~ taper_kozak.04(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.04 <- coef(kozak.04)[-10] p_kozak.04 <- coef(kozak.04)[10] h <- 20 dbh <- 25 hi <- 15 kozak.04_hi(dbh, h, hi, coef_kozak.04, p_kozak.04)
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.04 <- nlsLM(di ~ taper_kozak.04(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.04 <- coef(kozak.04)[-10] p_kozak.04 <- coef(kozak.04)[10] h <- 20 dbh <- 25 hi <- 15 kozak.04_hi(dbh, h, hi, coef_kozak.04, p_kozak.04)
Simulate the cutting 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.
kozak.04_logs( dbh, h, coef, p, assortments, stump_height, downgrade, broken, defect_height, eliminate, total_volume, only_vol )
kozak.04_logs( dbh, h, coef, p, assortments, stump_height, downgrade, broken, defect_height, eliminate, total_volume, only_vol )
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. |
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.
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.
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.04 <- nlsLM(di ~ taper_kozak.04(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.04 <- coef(kozak.04)[-10] p_kozak.04 <- coef(kozak.04)[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.04_logs(dbh, h, coef_kozak.04, p_kozak.04, assortments)
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.04 <- nlsLM(di ~ taper_kozak.04(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.04 <- coef(kozak.04)[-10] p_kozak.04 <- coef(kozak.04)[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.04_logs(dbh, h, coef_kozak.04, p_kozak.04, assortments)
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.
kozak.04_logs_plot( dbh, h, coef, p, assortments, stump_height, downgrade, broken, defect_height, lang )
kozak.04_logs_plot( dbh, h, coef, p, assortments, stump_height, downgrade, broken, defect_height, lang )
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'. |
check the kozak.04_logs
function help for more details.
a ggplot object.
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.04 <- nlsLM(di ~ taper_kozak.04(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.04 <- coef(kozak.04)[-10] p_kozak.04 <- coef(kozak.04)[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.04_logs(dbh, h, coef_kozak.04, p_kozak.04, assortments)
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.04 <- nlsLM(di ~ taper_kozak.04(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.04 <- coef(kozak.04)[-10] p_kozak.04 <- coef(kozak.04)[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.04_logs(dbh, h, coef_kozak.04, p_kozak.04, assortments)
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.
kozak.04_vol(dbh, h, coef, p, hi, h0)
kozak.04_vol(dbh, h, coef, p, hi, h0)
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). |
the Kozak (2004) variable-form taper function is represented mathematically by the following expression
di ~ b0*(dbh^b1)(h^b2)((1-(hi/h)^(1/3))/(1-(p^(1/3))))^(b3*(hi/h)^4+b4*(1/exp(dbh/h))+b5*((1-(hi/h)^(1/3))/(1-(p^(1/3))))^0.1+b6*(1/dbh)+b7*(h^(1-(hi/h)^(1/3)))+b8*((1-(hi/h)^(1/3))/(1-(p^(1/3)))))
a numeric value indicating the total or partial volume of the tree.
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.04 <- nlsLM(di ~ taper_kozak.04(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.04 <- coef(kozak.04)[-10] p_kozak.04 <- coef(kozak.04)[10] dbh <- 25 h <- 20 kozak.04_vol(dbh, h, coef_kozak.04, p_kozak.04) hi = 15 h0 = .2 kozak.04_vol(dbh, h, coef_kozak.04, p_kozak.04, hi, h0)
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.04 <- nlsLM(di ~ taper_kozak.04(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.04 <- coef(kozak.04)[-10] p_kozak.04 <- coef(kozak.04)[10] dbh <- 25 h <- 20 kozak.04_vol(dbh, h, coef_kozak.04, p_kozak.04) hi = 15 h0 = .2 kozak.04_vol(dbh, h, coef_kozak.04, p_kozak.04, hi, h0)
Estimates the diameter at a given height of a tree from the diameter at breast height, total height and the coefficients of the Kozak (1994) taper function.
kozak.94_di(dbh, h, hi, coef, p)
kozak.94_di(dbh, h, hi, coef, p)
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 (1994) taper function. |
p |
numerical value representing the first inflection point calculated in the segmented model of Max and Burkhart (1976). |
the Kozak (1994) variable-form taper function is represented mathematically by the following expression
di ~ b0*(dbhb1)*(b2dbh)((1-(hi/h)^0.5)/(1-p^0.5))^(b3+b4(hi/h)^(1/4)+b5*((hi/h))^(1/3)+b6*((hi/h)^0.5)+b7asin(1-(hi/h)^0.5)+b8(1/((dbh/h)+1))+b9*h)
a numeric value indicating the diameter at the given height.
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.94 <- nlsLM(di ~ taper_kozak.94(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, p), data=tree_scaling, start=list(b0=1.5,b1=1.5,b2=1,b3=-10,b4=50,b5=-10,b6=34,b7=10,b8=-1,b9=-0.01, p = .1)) coef_kozak.94 <- coef(kozak.94)[-11] p_kozak.94 <- coef(kozak.94)[11] dbh <- 25 h <- 20 hi <- 15 kozak.94_di(dbh, h, hi, coef_kozak.94, p_kozak.94)
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.94 <- nlsLM(di ~ taper_kozak.94(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, p), data=tree_scaling, start=list(b0=1.5,b1=1.5,b2=1,b3=-10,b4=50,b5=-10,b6=34,b7=10,b8=-1,b9=-0.01, p = .1)) coef_kozak.94 <- coef(kozak.94)[-11] p_kozak.94 <- coef(kozak.94)[11] dbh <- 25 h <- 20 hi <- 15 kozak.94_di(dbh, h, hi, coef_kozak.94, p_kozak.94)
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 (1994) taper function.
kozak.94_hi(dbh, h, di, coef, p)
kozak.94_hi(dbh, h, di, coef, p)
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 (1994) taper function. |
p |
numerical value representing the first inflection point calculated in the segmented model of Max and Burkhart (1976). |
the Kozak (1994) variable-form taper function is represented mathematically by the following expression
b0*(dbhb1)*(b2dbh)((1-(hi/h)^0.5)/(1-p^0.5))^(b3+b4(hi/h)^(1/4)+b5*((hi/h))^(1/3)+b6*((hi/h)^0.5)+b7asin(1-(hi/h)^0.5)+b8(1/((dbh/h)+1))+b9*h)
a numeric value indicating the height at which the given diameter occurs.
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.94 <- nlsLM(di ~ taper_kozak.94(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, p), data=tree_scaling, start=list(b0=1.5,b1=1.5,b2=1,b3=-10,b4=50,b5=-10,b6=34,b7=10,b8=-1,b9=-0.01, p = .1)) coef_kozak.94 <- coef(kozak.94)[-11] p_kozak.94 <- coef(kozak.94)[11] dbh <- 25 h <- 20 di <- 5 kozak.94_hi(dbh, h, di, coef_kozak.94, p_kozak.94)
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.94 <- nlsLM(di ~ taper_kozak.94(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, p), data=tree_scaling, start=list(b0=1.5,b1=1.5,b2=1,b3=-10,b4=50,b5=-10,b6=34,b7=10,b8=-1,b9=-0.01, p = .1)) coef_kozak.94 <- coef(kozak.94)[-11] p_kozak.94 <- coef(kozak.94)[11] dbh <- 25 h <- 20 di <- 5 kozak.94_hi(dbh, h, di, coef_kozak.94, p_kozak.94)
Simulate the cutting of logs from a tree from its measurements, taper function (Kozak (1994) variable-form taper equation ), trunk quality characteristics and harvest parameters such as stump height and assortments.
kozak.94_logs( dbh, h, coef, p, assortments, stump_height, downgrade, broken, defect_height, eliminate, total_volume, only_vol )
kozak.94_logs( dbh, h, coef, p, assortments, stump_height, downgrade, broken, defect_height, eliminate, total_volume, only_vol )
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
coef |
numerical vector containing nine coefficients of the Kozak (1994) taper function. |
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. |
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.
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.
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.94 <- nlsLM(di ~ taper_kozak.94(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, p), data=tree_scaling, start=list(b0=1.5,b1=1.5,b2=1,b3=-10,b4=50,b5=-10,b6=34,b7=10,b8=-1,b9=-0.01, p = .1)) coef_kozak.94 <- coef(kozak.94)[-11] p_kozak.94 <- coef(kozak.94)[11] 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) ) kozak.94_logs(dbh, h, coef_kozak.94, p_kozak.94, assortments)
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.94 <- nlsLM(di ~ taper_kozak.94(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, p), data=tree_scaling, start=list(b0=1.5,b1=1.5,b2=1,b3=-10,b4=50,b5=-10,b6=34,b7=10,b8=-1,b9=-0.01, p = .1)) coef_kozak.94 <- coef(kozak.94)[-11] p_kozak.94 <- coef(kozak.94)[11] 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) ) kozak.94_logs(dbh, h, coef_kozak.94, p_kozak.94, assortments)
Plot the shape of the tree and visualize the extracted logs based on the tree measurements, assortments data.frame, and the Kozak (1994) variable-form taper equation.
kozak.94_logs_plot( dbh, h, coef, p, assortments, stump_height, downgrade, broken, defect_height, lang )
kozak.94_logs_plot( dbh, h, coef, p, assortments, stump_height, downgrade, broken, defect_height, lang )
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
coef |
numerical vector containing nine coefficients of the Kozak (1994) taper function. |
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'. |
check the kozak.94_logs
function help for more details.
a ggplot object.
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.94 <- nlsLM(di ~ taper_kozak.94(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, p), data=tree_scaling, start=list(b0=1.5,b1=1.5,b2=1,b3=-10,b4=50,b5=-10,b6=34,b7=10,b8=-1,b9=-0.01, p = .1)) coef_kozak.94 <- coef(kozak.94)[-11] p_kozak.94 <- coef(kozak.94)[11] 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) ) kozak.94_logs_plot(dbh, h, coef_kozak.94, p_kozak.94, assortments)
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.94 <- nlsLM(di ~ taper_kozak.94(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, p), data=tree_scaling, start=list(b0=1.5,b1=1.5,b2=1,b3=-10,b4=50,b5=-10,b6=34,b7=10,b8=-1,b9=-0.01, p = .1)) coef_kozak.94 <- coef(kozak.94)[-11] p_kozak.94 <- coef(kozak.94)[11] 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) ) kozak.94_logs_plot(dbh, h, coef_kozak.94, p_kozak.94, assortments)
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 (1994) taper equation.
kozak.94_vol(dbh, h, coef, p, hi, h0)
kozak.94_vol(dbh, h, coef, p, hi, h0)
dbh |
tree diameter at breast height, in centimeters. |
h |
total tree height, in meters. |
coef |
numerical vector containing nine coefficients of the Kozak (1994) taper function. |
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). |
the Kozak (1994) variable-form taper function is represented mathematically by the following expression
di ~ b0*(dbhb1)*(b2dbh)((1-(hi/h)^0.5)/(1-p^0.5))^(b3+b4(hi/h)^(1/4)+b5*((hi/h))^(1/3)+b6*((hi/h)^0.5)+b7asin(1-(hi/h)^0.5)+b8(1/((dbh/h)+1))+b9*h)
a numeric value indicating the total or partial volume of the tree.
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.94 <- nlsLM(di ~ taper_kozak.94(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, p), data=tree_scaling, start=list(b0=1.5,b1=1.5,b2=1,b3=-10,b4=50,b5=-10,b6=34,b7=10,b8=-1,b9=-0.01, p = .1)) coef_kozak.94 <- coef(kozak.94)[-11] p_kozak.94 <- coef(kozak.94)[11] dbh <- 25 h <- 20 kozak.94_vol(dbh, h, coef_kozak.94, p_kozak.94) hi = 15 h0 = .2 kozak.94_vol(dbh, h, coef_kozak.94, p_kozak.94, hi, h0)
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.94 <- nlsLM(di ~ taper_kozak.94(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, p), data=tree_scaling, start=list(b0=1.5,b1=1.5,b2=1,b3=-10,b4=50,b5=-10,b6=34,b7=10,b8=-1,b9=-0.01, p = .1)) coef_kozak.94 <- coef(kozak.94)[-11] p_kozak.94 <- coef(kozak.94)[11] dbh <- 25 h <- 20 kozak.94_vol(dbh, h, coef_kozak.94, p_kozak.94) hi = 15 h0 = .2 kozak.94_vol(dbh, h, coef_kozak.94, p_kozak.94, hi, h0)
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.
poly5_di(dbh, h, hi, coef)
poly5_di(dbh, h, hi, coef)
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. |
a numeric value indicating the diameter at the given height.
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)
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)
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.
poly5_hi(dbh, h, di, coef)
poly5_hi(dbh, h, di, coef)
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. |
as numeric value indicating the height at which the given diameter occurs.
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)
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 the cutting 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.
poly5_logs( dbh, h, coef, assortments, stump_height, downgrade, broken, defect_height, eliminate, total_volume, only_vol )
poly5_logs( dbh, h, coef, assortments, stump_height, downgrade, broken, defect_height, eliminate, total_volume, only_vol )
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. |
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.
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.
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)
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)
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.
poly5_logs_plot( dbh, h, coef, assortments, stump_height, downgrade, broken, defect_height, lang )
poly5_logs_plot( dbh, h, coef, assortments, stump_height, downgrade, broken, defect_height, lang )
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'. |
check the poly5_logs
function help for more details.
a ggplot object.
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)
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)
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.
poly5_vol(dbh, h, coef, hi, h0)
poly5_vol(dbh, h, coef, hi, h0)
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). |
a numeric value indicating the total or partial volume of the tree.
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)
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)
Delete unwanted records from the dataset (e.g. outliers) by selecting them in a scatter plot.
select_and_remove(data, xvar, yvar)
select_and_remove(data, xvar, yvar)
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. |
the data.frame given to the data
argument, without the selected points.
## 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)
## 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 (2000) Taper Function.
taper_bi(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6)
taper_bi(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6)
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. |
a numeric value indicating the diameter at the section.
Bi, H. (2000). Trigonometric variable-form taper equations for Australian eucalypts. Forest Science, 46(3), 397-409.
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))
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.
taper_kozak.04(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, p)
taper_kozak.04(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, p)
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). |
a numeric value indicating the diameter at the section.
Kozak, A. (2004). My last words on taper equations. The Forestry Chronicle, 80(4), 507-515.
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.04 <- nlsLM(di ~ taper_kozak.04(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))
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.04 <- nlsLM(di ~ taper_kozak.04(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))
Kozak (1994) Taper Function.
taper_kozak.94(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, p)
taper_kozak.94(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, p)
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 , b9
|
model parameters. |
p |
numerical value representing the first inflection point calculated in the segmented model of Max and Burkhart (1976). |
a numeric value indicating the diameter at the section.
Kozak, A. (1994). Development of taper equations by BEC zones and species. Report to the Resources Inventory Branch, B.C. Ministry of Forests. Sept. 1994. Kozak, A. (1997). Effects of multicollinearity and autocorrelation on the variable-exponent taper functions. Canadian Journal of Forest Research, Ottawa, v. 27, n. 5, p. 619-629, 1997.
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.94 <- nlsLM(di ~ taper_kozak.94(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, p), data=tree_scaling, start=list(b0=1.5,b1=1.5,b2=1,b3=-10,b4=50,b5=-10,b6=34,b7=10,b8=-1,b9=-0.01, p = .1))
library(dplyr) library(minpack.lm) library(timbeR) tree_scaling <- tree_scaling %>% mutate(did = di/dbh, hih = hi/h) kozak.94 <- nlsLM(di ~ taper_kozak.94(dbh, h, hih, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, p), data=tree_scaling, start=list(b0=1.5,b1=1.5,b2=1,b3=-10,b4=50,b5=-10,b6=34,b7=10,b8=-1,b9=-0.01, p = .1))
Diameter (cm) and height (m) measurements along the bole of 8 Pinus taeda trees.
data(tree_scaling)
data(tree_scaling)
A data frame with 136 rows and 5 variables:
tree unique id
diameter at breast height, in centimeters
total tree height, in meters
tree section height, in meters
diameter at the tree section, in centimeters