Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ropensci/allodb

An R package for biomass estimation at extratropical forest plots.
https://github.com/ropensci/allodb

Last synced: 3 months ago
JSON representation

An R package for biomass estimation at extratropical forest plots.

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
fig.width = 6,
fig.height = 5
)
```

# allodb: An R package for biomass estimation at extratropical forest plots

[![peer-review](https://badges.ropensci.org/436_status.svg)](https://github.com/ropensci/software-review/issues/436)
[![Codecov test coverage](https://codecov.io/gh/ropensci/allodb/branch/master/graph/badge.svg)](https://codecov.io/gh/ropensci/allodb?branch=master)
[![R-CMD-check](https://github.com/ropensci/allodb/workflows/R-CMD-check/badge.svg)](https://github.com/ropensci/allodb/actions)

## Introduction

Allometric equations for calculation of tree aboveground biomass (AGB) form the basis for estimates of forest carbon storage and exchange with the atmosphere. While standard models exist to calculate forest biomass across the tropics, we lack a standardized tool for computing AGB across the global extratropics.

_allodb_ was conceived as a framework to standardize and simplify the biomass estimation process across globally distributed extratropical forests (mainly temperate and boreal forests).
With _allodb_ we aimed to: a) compile relevant published and unpublished allometries, focusing on AGB but structured to handle other variables (e.g., height); b) objectively select and integrate appropriate available equations across the full range of tree sizes; and c) serve as a platform for future updates and expansion to other research sites.

The _allodb_ package contains a dataset of systematically selected published allometric equations. This dataset was built based on 701 woody species identified at 24 large [ForestGEO forest dynamic plots](https://forestgeo.si.edu/) representing all major extratropical forest types. A total of 570 parsed allometric equations to estimate individual tree biomass were retrieved, checked, and combined using a weighting function designed to ensure optimal equation selection over the full tree size range with smooth transitions across equations. The equation dataset used can be customized with built-in functions that subset the original dataset and add new equations.

The package provides functions to estimate tree biomass based on user-provided census data (tree diameter, taxonomic identification, and plot coordinates). New allometric equations are calibrated for each species and location by resampling the original equations; equations with a larger sample size and/or higher taxonomic and climatic similarity with the species and location in question are given a higher weight in this process.

## Installation

Install the development version of _allodb_ from GitHub:

```R
# install.packages("remotes")
remotes::install_github("ropensci/allodb")
```

## Examples

Prior to calculating tree biomass using _allodb_, users need to provide a table (i.e. dataframe) with DBH (cm), parsed species Latin names, and site(s) coordinates. In the following examples we use data from the Smithsonian Conservation Biology Institute, USA (SCBI) ForestGEO dynamics plot (trees from 1 hectare surveyed in 2008). Full tree census data can be requested through the [ForestGEO portal](https://forestgeo.si.edu/explore-data).

```{r open-data}
library(allodb)
data(scbi_stem1)
```

The biomass of all trees in one (or several) censuses can be estimated using the `get_biomass` function.

```{r calc-agb-all}
scbi_stem1$agb <-
get_biomass(
dbh = scbi_stem1$dbh,
genus = scbi_stem1$genus,
species = scbi_stem1$species,
coords = c(-78.2, 38.9)
)
```

Biomass for a single tree can be estimated given dbh and species identification (results in kilograms).

```{r calc-agb-poplar}
get_biomass(
dbh = 50,
genus = "liriodendron",
species = "tulipifera",
coords = c(-78.2, 38.9)
)
```

Users can modify the set of equations that will be used to estimate the biomass using the `new_equations` function. The default option is the entire _allodb_ equation table. Users can also work on a subset of those equations, or add new equations to the table (see `?allodb::new_equations`). This new equation table should be provided as an argument in the `get_biomass` function.

```{r}
show_cols <- c("equation_id", "equation_taxa", "equation_allometry")
eq_tab_acer <- new_equations(subset_taxa = "Acer")
head(eq_tab_acer[, show_cols])
```

Within the `get_biomass` function, this equation table is used to calibrate a new allometric equation for all species/site combinations in the user-provided dataframe. This is done by attributing a weight to each equation based on its sampling size, and taxonomic and climatic similarity with the species/site combination considered.

```{r weights}
allom_weights <-
weight_allom(
genus = "Acer",
species = "rubrum",
coords = c(-78, 38)
)

## visualize weights
equ_tab_acer <- new_equations()
equ_tab_acer$weights <- allom_weights
keep_cols <-
c(
"equation_id",
"equation_taxa",
"sample_size",
"weights"
)
order_weights <- order(equ_tab_acer$weights, decreasing = TRUE)
equ_tab_acer <- equ_tab_acer[order_weights, keep_cols]
head(equ_tab_acer)
```

Equations are then resampled within their original DBH range: the number of resampled values for each equation is proportional to its weight (as attributed by the `weight_allom` function).

```{r resample-acer, eval = TRUE}
df_resample <-
resample_agb(
genus = "Acer",
species = "rubrum",
coords = c(-78, 38)
)

plot(
df_resample$dbh,
df_resample$agb,
xlab = "DBH (cm)",
ylab = "Resampled AGB values (kg)"
)
```

The resampled values are then used to fit the following nonlinear model: , with i.i.d. . The parameters (_a_, _b_, and _sigma_) are returned by the `est_params()` function.

The resampled values (dots) and new fitted equation (red dotted line) can be visualized with the `illustrate_allodb()` function.

```{r est-params-acer, eval = TRUE, fig.height=4, fig.width=10}
pars_acer <- est_params(
genus = "Acer",
species = "rubrum",
coords = c(-78, 38)
)
illustrate_allodb(
genus = "Acer",
species = "rubrum",
coords = c(-78, 38)
)
```

The `est_params` function can be used for all species/site combinations in the dataset at once.

```{r est-params-all, eval = TRUE}
params <- est_params(
genus = scbi_stem1$genus,
species = scbi_stem1$species,
coords = c(-78.2, 38.9)
)
head(params)
```

AGB is then recalculated as `agb = a * dbh^b` within the `get_biomass` function.

Please note that this package is released with a [Contributor
Code of Conduct](https://ropensci.org/code-of-conduct/).
By contributing to this project, you agree to abide by its terms.