knitr::opts_chunk$set( collapse = TRUE, echo = TRUE, comment = "#>", fig.align = "center") require(knitr) require(BIOMASS)
For the sake of clarity, and to be consistent with the BIOMASS paper (Réjou-Méchain et al. 2017), this vignette follows the same workflow as presented in the paper:
As can be seen, the estimate of the above ground biomass (AGB) of a tree, and its associated uncertainty, is based on its wood density, diameter, and height.
However, exhaustive values of wood density and height are rarely available in forest inventory data. This is why the package proposes an estimate of these two covariables, based on more usual data.
In this vignette, we will use some of the data obtained in 2012 from a forest inventory conducted in 2012 in the Nouragues forest (French Guiana). For educational purpose, some virtual trees have been added to the data.
data("NouraguesTrees") knitr::kable(head(NouraguesTrees))
These data do not contain any information on wood density or height of trees. Only diameter is known, as no estimate can be made without this information.
Wood density is estimated from tree taxonomy, using the global wood density database as a reference. So the first step might be to correct tree taxonomy.
This is done with the correctTaxo()
function, but before calling it, let's speak about cache !
When the function is called for the first time with the argument useCache = TRUE
, a temporary file containing the request to TNRS will be automatically created in an existing folder. Once this has been done, during the current session the use of useCache = TRUE
will access the saved temporary file in order to avoid time-consuming replication of server requests. But by quitting the current R session, this temporary file will be removed. So before calling correctTaxo()
, we advise you to define a folder which will host the cache file permanently, enabling to work offline.
# By default createCache() # Or if you want to set your own cache folder createCache("the_path_to_your_cache_folder") # Or options("BIOMASS.cache" = "the_path_to_your_cache_folder")
That said, let's continue with the call to correctTaxo()
function:
Taxo <- correctTaxo( genus = NouraguesTrees$Genus, # genus also accepts the whole species name (genus + species) or (genus + species + author) species = NouraguesTrees$Species, useCache = TRUE, verbose = FALSE) saveRDS(Taxo, file = "saved_data/Taxo_vignette.rds")
Taxo <- readRDS(file = "saved_data/Taxo_vignette.rds")
The corrected genus and species of the trees can now be added to the data:
NouraguesTrees$GenusCorrected <- Taxo$genusCorrected NouraguesTrees$SpeciesCorrected <- Taxo$speciesCorrected
Here, as an example, the species name of the fourth tree has been corrected from "guyanensis" to "guianensis" (the fourth row of correctTaxo() output has a TRUE value for the column nameModified) :
NouraguesTrees$Species[4]
Taxo[4,]
If you want (but this is optional for the rest), you can retrieve APG III families and orders from genus names.
APG <- getTaxonomy(NouraguesTrees$GenusCorrected, findOrder = TRUE) NouraguesTrees$familyAPG <- APG$family NouraguesTrees$orderAPG <- APG$order
Wood densities are retrieved using getWoodDensity()
function. By default, this function assigns to each taxon a species- or genus-level average if at least one wood density value of the same species or genus is available in the reference database. For unidentified trees or if the genus is missing in the reference database, the stand-level mean wood density is assigned to the tree.
wood_densities <- getWoodDensity( genus = NouraguesTrees$GenusCorrected, species = NouraguesTrees$SpeciesCorrected, stand = NouraguesTrees$Plot # for unidentified or non-documented trees in the reference database ) NouraguesTrees$WD <- wood_densities$meanWD
For information, here are the number of wood density values estimated at the species, genus and plot level:
# At species level sum(wood_densities$levelWD == "species") # At genus level sum(wood_densities$levelWD == "genus") # At plot level sum(!wood_densities$levelWD %in% c("genus", "species"))
The family
argument also assigns to the trees a family-level wood density average, but bear in mind that the taxon-average approach gives relatively poor estimates above the genus level (Flores & Coomes 2011).
Additional wood density values can be added using the addWoodDensityData
argument (here invented for the example):
LocalWoodDensity <- data.frame( genus = c("Paloue", "Handroanthus"), species = c("princeps", "serratifolius"), wd = c(0.65, 0.72) ) add_wood_densities <- getWoodDensity( genus = NouraguesTrees$GenusCorrected, species = NouraguesTrees$SpeciesCorrected, family = NouraguesTrees$familyAPG, stand = NouraguesTrees$Plot, addWoodDensityData = LocalWoodDensity )
As tree height measurements are rare, or rarely exhaustive, BIOMASS proposes three methods to estimate tree height:
If a subset of well-measured trees is available in the studied region:
If not:
As no height was measured in our dataset, we will use the NouraguesHD
dataset, which contains the height and diameter measurements of two 1-ha plots from the Nouragues forest.
data("NouraguesHD")
The modelHD()
function is used to either compare four implemented models to fit H–D relationships in the tropics, or to compute the desired H-D model.
Here we first compare the four H-D models:
HD_res <- modelHD( D = NouraguesHD$D, H = NouraguesHD$H, useWeight = TRUE, drawGraph = T) kable(HD_res)
As the log2 model has the lowest RSE, we build this model using the method
argument and add its predictions to the dataset with the retrieveH()
function:
HDmodel <- modelHD( D = NouraguesHD$D, H = NouraguesHD$H, method = "log2", useWeight = TRUE) H_model <- retrieveH( D = NouraguesTrees$D, model = HDmodel) NouraguesTrees$H_model <- H_model$H
Note that we could have created a model for each stand present in NouraguesHD data using the plot
argument.
No need to compute any model here, as the predictions of the model proposed by Feldspausch et al. are directly retrieved by the retrieveH()
function. Simply indicate the region concerned:
H_feldspausch <- retrieveH( D = NouraguesTrees$D, region = "GuianaShield") NouraguesTrees$H_feldspausch <- H_feldspausch$H
Available regions are listed in the documentation of the function.
In the same way as for the previous model, the predictions of the model proposed by Chave et al. are directly retrieved by the retrieveH()
function. Coordinates of the plot (or trees) in a longitude/latitude format must be provided.
data("NouraguesCoords") #contains corner coordinates coords <- apply(NouraguesCoords[c("Long","Lat")] , 2, mean) # compute the mean of the corner coordinates H_chave <- retrieveH( D = NouraguesTrees$D, coord = coords) NouraguesTrees$H_chave <- H_chave$H
Once tree diameter, wood density and height have been retrieved, the generalised allometric model (eqn 4
of Chave et al. (2014)) can be used with the computeAGB()
function, where AGB values are reported in Mg instead of in kg:
NouraguesTrees$AGB <- computeAGB( D = NouraguesTrees$D, WD = NouraguesTrees$WD, H = NouraguesTrees$H_model #here with the local H-D predictions )
#saveRDS(NouraguesTrees, file = "saved_data/NouraguesTreesAGB.rds")
For AGB estimates using tree heights obtained by the "Chave method" (H_chave), it is more accurate to provide the area coordinates directly instead of the tree height estimates:
NouraguesTrees$AGB_Chave <- computeAGB( D = NouraguesTrees$D, WD = NouraguesTrees$WD, coord = coords)
The AGBmonteCarlo()
function allows the user to propagate different sources of error up to the final AGB estimate.
The error propagation due to the uncertainty of the model parameters of the AGB allometric equation (Chave et al. 2014) is automatically performed by the function. However, the propagation of the error due to the uncertainty of the model variables (D, WD and H) can be parameterized by the user.
Using the Dpropag
argument of the AGBmonteCarlo()
function, the user can set diameter measurement errors by:
Dpropag = 1
)Dpropag = "chave2004"
, where small errors are applied on 95% of the trees and large errors to the remaining 5%D_error_prop <- AGBmonteCarlo( D = NouraguesTrees$D, WD = NouraguesTrees$WD, H = NouraguesTrees$H_model, Dpropag = "chave2004", errWD = rep(0,nrow(NouraguesTrees)), errH = 0 # no error propagation on WD and H here )
The getWoodDensity()
function returns prior standard deviation values associated with each tree wood density using the mean standard deviation of the global wood density database at the species, genus and family levels.
This output can be provided through the errWD
argument:
WD_error_prop <- AGBmonteCarlo( D = NouraguesTrees$D, WD = NouraguesTrees$WD, H = NouraguesTrees$H_model, errWD = wood_densities$sdWD, Dpropag = 0 , errH = 0 # no error propagation on D and H here )
The user can provide either a SD value or a vector of SD values associated with tree height measurement errors, using the errH
argument.
retrieveH()
function for the errH
argument:H_feld_error_prop <- AGBmonteCarlo( D = NouraguesTrees$D, WD = NouraguesTrees$WD, H = NouraguesTrees$H_model, errH = H_feldspausch$RSE, Dpropag = 0 , errWD = rep(0,nrow(NouraguesTrees)) # no error propagation on D and WD here )
errH
and the H
arguments, the user can provide the output of the modelHD()
function using the modelHD
argument.H_model_error_prop <- AGBmonteCarlo( D = NouraguesTrees$D, WD = NouraguesTrees$WD, # we do not provide H HDmodel = HDmodel, # but we provide HDmodel Dpropag = 0 , errWD = rep(0,nrow(NouraguesTrees)) # no error propagation on D and WD here )
Let's propagate all sources of errors using the HD-model:
error_prop <- AGBmonteCarlo( D = NouraguesTrees$D, WD = NouraguesTrees$WD, # we do not provide H HDmodel = HDmodel, # but we provide HDmodel Dpropag = "chave2004", errWD = wood_densities$sdWD) error_prop[(1:4)]
The first four elements of the output contain the mean, median, standard deviation and credibility intervals of the total AGB of the dataset but nothing about the AGB at the plot level. To do this, you can use the summaryByPlot()
function:
AGB_by_plot <- summaryByPlot(AGB_val = error_prop$AGB_simu, plot = NouraguesTrees$Plot, drawPlot = TRUE)
Finally, the last element ($AGB_simu
) of the AGBmonteCarlo()
output is a matrix containing the simulated tree AGB values (in rows) for each iteration of the Monte Carlo procedure (in columns).
If you want to use a mix of directly-measured height and of estimated ones, you can proceed as follows:
(@) Build a vector of H and RSE where we assume an error of 0.5 m on directly measured trees
# NouraguesHD contains 163 trees that were not measured NouraguesHD$Hmix <- NouraguesHD$H NouraguesHD$RSEmix <- 0.5 filt <- is.na(NouraguesHD$Hmix) NouraguesHD$Hmix[filt] <- retrieveH(NouraguesHD$D, model = HDmodel)$H[filt] NouraguesHD$RSEmix[filt] <- HDmodel$RSE
(@) Apply the AGBmonteCarlo by setting the height values and their errors (which depend on whether the trees were directly measured or estimated)
wd <- getWoodDensity(NouraguesHD$genus, NouraguesHD$species) resultMC <- AGBmonteCarlo( D = NouraguesHD$D, WD = wd$meanWD, errWD = wd$sdWD, H = NouraguesHD$Hmix, errH = NouraguesHD$RSEmix, Dpropag = "chave2004" ) summaryByPlot(AGB_val = resultMC$AGB_simu, plot = NouraguesHD$plotId, drawPlot = TRUE)
If you would like to share a code that might be useful to users (code authorship will be respected), you can create a new issue on the BIOMASS github page, or contact Dominique (dominique.lamonica@ird.fr).
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.