A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

allodb

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

Category: Biosphere
Sub Category: Biomass

Keywords from Contributors

forests dynamic forestgeo ecology climate tree-rings

Last synced: about 20 hours ago
JSON representation

Repository metadata

An R package for biomass estimation at extratropical forest plots.

README.Rmd

          ---
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://app.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)
[![R-CMD-check](https://github.com/ropensci/allodb/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ropensci/allodb/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/ropensci/allodb/graph/badge.svg)](https://app.codecov.io/gh/ropensci/allodb)


## 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("pak")
pak::pak("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.

## Contributors






All contributions to this project are gratefully acknowledged using the [`allcontributors` package](https://github.com/ropensci/allcontributors) following the [all-contributors](https://allcontributors.org) specification. Contributions of any kind are welcome!

### Code


gonzalezeb

maurolepore

cpiponiot

teixeirak

jeroen
### Issue Authors

ValentineHerr

adamhsparks

lucas-johnson
### Issue Contributors

ErvanCH

laosuz

tylerlittlefield

rudeboybert

tlbeckham

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 6 days ago

Total Commits: 1,615
Total Committers: 7
Avg Commits per committer: 230.714
Development Distribution Score (DDS): 0.389

Commits in past year: 9
Committers in past year: 3
Avg Commits per committer in past year: 3.0
Development Distribution Score (DDS) in past year: 0.333

Name Email Commits
Erika Gonzalez-Akre g****b@s****u 987
maurolepore m****e@g****m 391
Camille Piponiot c****t@g****m 210
Kristina Anderson-Teixeira t****k@s****u 19
Lepore L****M@S****U 5
Bernard Kwame Solodzi 8****i 2
Jeroen Ooms j****s@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 2 days ago

Total issues: 168
Total pull requests: 86
Average time to close issues: 7 months
Average time to close pull requests: 5 days
Total issue authors: 9
Total pull request authors: 4
Average comments per issue: 3.77
Average comments per pull request: 0.97
Merged pull request: 67
Bot issues: 0
Bot pull requests: 0

Past year issues: 9
Past year pull requests: 15
Past year average time to close issues: 4 days
Past year average time to close pull requests: 27 minutes
Past year issue authors: 3
Past year pull request authors: 4
Past year average comments per issue: 0.78
Past year average comments per pull request: 0.47
Past year merged pull request: 8
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/ropensci/allodb

Top Issue Authors

  • maurolepore (96)
  • teixeirak (31)
  • gonzalezeb (19)
  • cpiponiot (10)
  • ValentineHerr (7)
  • adamhsparks (2)
  • SebastianKyle (1)
  • lucas-johnson (1)
  • TillF (1)

Top Pull Request Authors

  • maurolepore (76)
  • mauro-ixpantia (7)
  • Bsolodzi (2)
  • georgewoolsey (1)

Top Issue Labels

  • enhancement (13)
  • ro-hackathon-2025 (7)
  • code (7)
  • good first issue (7)
  • priority high (7)
  • bug (6)
  • docs (5)
  • meeting records (5)
  • help wanted (4)
  • question (4)
  • feature (3)
  • priority medium (3)
  • priority low (3)
  • needs-review (1)
  • duplicate (1)
  • performance (1)
  • wip (1)

Top Pull Request Labels


Dependencies

DESCRIPTION cran
  • R >= 3.4 depends
  • data.table * imports
  • ggplot2 * imports
  • rlang * imports
  • tibble * imports
  • withr * imports
  • covr * suggests
  • knitr * suggests
  • rmarkdown * suggests
  • spelling * suggests
  • testthat >= 3.0.0 suggests
  • utils * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml actions
  • actions/checkout v2 composite
  • r-lib/actions/pr-fetch v1 composite
  • r-lib/actions/pr-push v1 composite
  • r-lib/actions/setup-r v1 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v4 composite
  • codecov/codecov-action v4 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite

Score: 5.934894195619588