| Title: | Generate Annualized Carbon and Biomass Estimates from FIA Data |
|---|---|
| Description: | Uses interpolation and extrapolation to create annualized versions of Forest Inventory Analysis (FIA). |
| Authors: | Eric R. Scott [aut, cre] (ORCID: <https://orcid.org/0000-0002-7430-7879>), Renata Diaz [aut] (ORCID: <https://orcid.org/0000-0003-0803-4734>), Dani Steinberg [ctb] (ORCID: <https://orcid.org/0000-0002-3695-3837>), David M. Walker [ctb], Kristina Riemer [ctb] (ORCID: <https://orcid.org/0000-0003-3802-3331>), Margaret Evans [ctb], Grant Domke [ctb] (ORCID: <https://orcid.org/0000-0003-0485-0355>), Brian F. Walters [ctb], Arizona Board of Regents on behalf of The University of Arizona [cph] (ROR: <https://ror.org/0054f1w39>) |
| Maintainer: | Eric R. Scott <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 2.2.0.9000 |
| Built: | 2026-05-28 06:25:39 UTC |
| Source: | https://github.com/Evans-Ecology-Lab/forestTIME |
Creates a tree_ID and/or a plot_ID column that contain unique tree and
plot identifiers, respectively. These are created by pasting together the
values for UNITCD, STATECD, COUNTYCD, PLOT and in the case of trees
SUBP and TREE.
fia_add_composite_ids(data)fia_add_composite_ids(data)
data |
A tibble or data frame with at least the |
The input tibble with a plot_ID and possibly also a tree_ID
column added
See fia_split_composite_ids() for "undoing" this.
db <- fia_load("RI", dir = system.file("exdata", package = "forestTIME")) fia_add_composite_ids(db$TREE)db <- fia_load("RI", dir = system.file("exdata", package = "forestTIME")) fia_add_composite_ids(db$TREE)
Converts tidied panel data into annualized data with interpolated measurments
for trees for years between inventories. This happens in three steps, which
can be "manually" replicated by chaining other forestTIME
functions.
fia_annualize(data_tidy, use_mortyr = TRUE)fia_annualize(data_tidy, use_mortyr = TRUE)
data_tidy |
A tibble produced by |
use_mortyr |
logical; Use |
First, data is expanded by expand_data() to add rows for years between
inventories for each tree in the data. Next, data is interpolated with
interpolate_data(). Finally, adjust_mortality() is applied. For trees
that die and/or fall between inventories, we adjust their history according
either to a recorded MORTYR (if use_morty = TRUE) or, as a fall-back, the
midpoint between surveys, rounded down. Unlike these intermediate functions,
fia_annualize() produces a dataset which can be safely used for other
analyses (with the caveat that all of this is experimental).
Most users should use this "wrapper" function rather than running each
step separately since the intermediate steps may contain data artifacts.
However, one reason to use the stepwise workflow would be to save time when
generating interpolated data with and without using MORTYR as
interpolate_data() is the slowest step.
For more details on each step, see: expand_data(),
interpolate_data(), adjust_mortality()
## Not run: db <- db <- fia_load("RI", dir = system.file("exdata", package = "forestTIME")) data_tidy <- fia_tidy(db) data_annualized <- fia_annualize(data_tidy) ## End(Not run)## Not run: db <- db <- fia_load("RI", dir = system.file("exdata", package = "forestTIME")) data_tidy <- fia_tidy(db) data_annualized <- fia_annualize(data_tidy) ## End(Not run)
This adds columns from various POP_* tables to annualized data so that it
can be used for stratified estimation (see, for example, FIA Demystified).
Each plot in each year is matched with an EVALID and it's associated data as
such:
The EVALID must have both the "EXPVOL" and "EXPCURR" EVAL_TYP.
The YEAR must be between START_INVYR and END_INVYR.
The first matching EVALID is used—i.e. if the YEAR is 2002 and there are
EVALIDs for 2000–2003, 2001–2004, and 2002–2005, the one from
2000–2003 will be matched.
fia_assign_strata(data_annualized, db)fia_assign_strata(data_annualized, db)
data_annualized |
Annualized data produced by |
db |
The list of tables produced by |
EVALID-associated data added by this function may be in conflict with the
results of interpolation by fia_annualize()! When using this function to
do stratified estimation, use the PLOT_STATUS_CD as part of the domain
indicator to correctly exclude any non-sampled plots with no tree data!
fia_eval_info() to see all possible EVALIDs associated with plots.
## Not run: # Load example data included in package db <- fia_load("RI", dir = system.file("exdata", package = "forestTIME")) # Annualize data data_annualized <- db |> fia_tidy() |> fia_annualize(use_mortyr = FALSE) # Assign plots to strata, estimation units, and EVLIDs data_stratified <- fia_assign_strata(data_annualized, db) ## End(Not run)## Not run: # Load example data included in package db <- fia_load("RI", dir = system.file("exdata", package = "forestTIME")) # Annualize data data_annualized <- db |> fia_tidy() |> fia_annualize(use_mortyr = FALSE) # Assign plots to strata, estimation units, and EVLIDs data_stratified <- fia_assign_strata(data_annualized, db) ## End(Not run)
The zip files are smaller than just the *_TREE.csv, so this just downloads
the whole zip and extracts the required CSV files. Uses
curl::multi_download() which resumes partial skips already completed
downloads when run subsequent times.
fia_download( states, download_dir = "fia", extract = c("forestTIME", "rFIA", "all", "none"), keep_zip = TRUE )fia_download( states, download_dir = "fia", extract = c("forestTIME", "rFIA", "all", "none"), keep_zip = TRUE )
states |
Vector of state abbreviations; for all states use |
download_dir |
Where to save the zip files. |
extract |
Which files to extract from the downloaded zip file—those
needed by |
keep_zip |
Logical; keep the .zip file after CSVs are extracted?
Defaults to |
Returns nothing.
## Not run: # "Standard" download fia_download(states = c("RI", "DE")) # Extract enough tables so it works with rFIA::readFIA() also fia_download(states = c("RI", "DE"), extract = "rFIA") ## End(Not run)## Not run: # "Standard" download fia_download(states = c("RI", "DE")) # Extract enough tables so it works with rFIA::readFIA() also fia_download(states = c("RI", "DE"), extract = "rFIA") ## End(Not run)
Estimates biomass and carbon variables using the National Scale Volume and Biomass estimators (NSVB).
fia_estimate(data)fia_estimate(data)
data |
A data frame or tibble; generally the output of |
A tibble with the additional columns DRYBIO_AG and CARBON_AG
that correspond to the FIAdb definitions of those variables.
David Walker
Westfall, J.A., Coulston, J.W., Gray, A.N., Shaw, J.D., Radtke, P.J., Walker, D.M., Weiskittel, A.R., MacFarlane, D.W., Affleck, D.L.R., Zhao, D., Temesgen, H., Poudel, K.P., Frank, J.M., Prisley, S.P., Wang, Y., Sánchez Meador, A.J., Auty, D., Domke, G.M., 2024. A national-scale tree volume, biomass, and carbon modeling system for the United States. U.S. Department of Agriculture, Forest Service. doi:10.2737/wo-gtr-104
## Not run: library(forestTIME) db <- fia_load("RI") data_tidy <- fia_tidy(db) data_annualized <- fia_annualize(data_tidy) data_carbon <- fia_estimate(data_annualized) ## End(Not run)## Not run: library(forestTIME) db <- fia_load("RI") data_tidy <- fia_tidy(db) data_annualized <- fia_annualize(data_tidy) data_carbon <- fia_estimate(data_annualized) ## End(Not run)
Wrapper for rFIA::readFIA() that reads in the necessary tables
fia_load(states, dir = "fia")fia_load(states, dir = "fia")
states |
character; state/ US territory abbreviations (e.g. 'AL', 'MI', etc.) indicating which state subsets to read. Data for each state must be in |
dir |
directory where .csv files of FIA tables are stored. |
A list of data frames
## Not run: fia_download(states = "RI") RI_db <- fia_load("RI") ## End(Not run)## Not run: fia_download(states = "RI") RI_db <- fia_load("RI") ## End(Not run)
Splits the composite ID columns tree_ID and/or plot_ID into their
original component columns
fia_split_composite_ids(data)fia_split_composite_ids(data)
data |
A tibble with the |
The input tibble with additional columns UNITCD, STATECD,
COUNTYCD, PLOT and possibly SUBP and TREE.
db <- fia_load("RI", dir = system.file("exdata", package = "forestTIME")) data_tidy <- fia_tidy(db) fia_split_composite_ids(data_tidy)db <- fia_load("RI", dir = system.file("exdata", package = "forestTIME")) data_tidy <- fia_tidy(db) fia_split_composite_ids(data_tidy)
Reads in all the tables needed for carbon estimation and population scaling and joins them into a single table. Then, some additional data cleaning steps are performed.
Creates unique tree and plot identifiers (tree_ID and plot_ID,
respectively).
Fills in missing values for ACTUALHT with values from HT to prepare
for interpolation.
Overwrites SPCD with whatever the last value of SPCD is for each tree
(to handle trees that change SPCD).
Fills a tree's MORTYR column so every row contains the recorded
mortality year.
Filters to only include inventories that came after the start of the annual inventory in each state.
fia_tidy(db)fia_tidy(db)
db |
A list of tables produced by |
A tibble.
db <- fia_load("RI", dir = system.file("exdata", package = "forestTIME")) data_tidy <- fia_tidy(db)db <- fia_load("RI", dir = system.file("exdata", package = "forestTIME")) data_tidy <- fia_tidy(db)
A data frame tha matches the STATECD column used in FIA data to the two
letter state abbreviations and the total land area of the state in acres.
state_areasstate_areas
An object of class spec_tbl_df (inherits from tbl_df, tbl, data.frame) with 50 rows and 3 columns.