The r3PG R package implements the 3-PG (Physiological Processes Predicting Growth) model which was originally developed by Landsberg and Waring (1997). Specifically, this R implementation of the model is based directly on the Python version created by Wei et al. (2014) to incorporate predictions of stable isotope compositions. This vignette is focused specifically on using r3PG and predicting carbon and oxygen isotopic values. For a thorough introduction to 3PG and raw data for many of the examples presented here, check out the course materials available online.
As implemented in R, the 3PG model requires two types of input which are climate data and information about the site and tree species. This structure is a legacy from the earlier vesions, and for compatibility “.cfg” files used in the Python version can also be used. However, r3PG also accepts native R objects and includes functions for reading and editing model configuration data within R. Below, we provide a workflow for comparing the stable isotope predictions for a variety of tree species at four sites with different climates.
Install r3PG from GitHub using devtools.
devtools::install_github(repo = "griffithdan/r3PG")
library(r3PG)
The “r3PG” R package has monthly climate normals available for four example sites.
data("clim.WesternOR", "clim.Argentina", "clim.NorthCarolina", "clim.BritishColumbia")
The “r3PG” R package includes configurations for seven tree species. We can compare some of the parameters that are different. However, note that the configurations use the same parameters for most of the site variable (based on OR).
data("cfg.Pseudotsuga.menziesii")
data("cfg.Pinus.ponderosa")
data("cfg.Eucalyptus.globulus")
data("cfg.Picea.sitchensis")
data("cfg.Pinus.contorta")
data("cfg.Pinus.radiata")
data("cfg.Pinus.taeda")
Now we should modify some other configuration detials for the model runs, such as changing the duration of the run.
cfg.Pinus.ponderosa$TimeRange
cfg.Pinus.ponderosa$TimeRange$EndAge <- 25
cfg.Pinus.ponderosa$TimeRange$EndYear <- 1975
cfg.Pseudotsuga.menziesii$TimeRange$EndAge <- 25
cfg.Pseudotsuga.menziesii$TimeRange$EndYear <- 1975
doug.OR <- run_3pg(config = cfg.Pseudotsuga.menziesii,
climate = clim.WesternOR, output = FALSE, python_indexing = FALSE)
doug.BC <- run_3pg(config = cfg.Pseudotsuga.menziesii,
climate = clim.BritishColumbia, output = FALSE, python_indexing = FALSE)
doug.NC <- run_3pg(config = cfg.Pseudotsuga.menziesii,
climate = clim.NorthCarolina, output = FALSE, python_indexing = FALSE)
cfg.Pseudotsuga.menziesii$SiteCharacteristics$lat <- -40
doug.AR <- run_3pg(config = cfg.Pseudotsuga.menziesii,
climate = clim.Argentina, output = FALSE, python_indexing = FALSE)
pipo.OR <- run_3pg(config = cfg.Pinus.ponderosa,
climate = clim.WesternOR, output = FALSE, python_indexing = FALSE)
pipo.BC <- run_3pg(config = cfg.Pinus.ponderosa,
climate = clim.BritishColumbia, output = FALSE, python_indexing = FALSE)
pipo.NC <- run_3pg(config = cfg.Pinus.ponderosa,
climate = clim.NorthCarolina, output = FALSE, python_indexing = FALSE)
cfg.Pseudotsuga.menziesii$cfg.Pinus.ponderosa$lat <- -40
pipo.AR <- run_3pg(config = cfg.Pinus.ponderosa,
climate = clim.Argentina, output = FALSE, python_indexing = FALSE)
# Convert from D13C of cellulose to wood
doug.OR$D13CTissue <- doug.OR$D13CTissue + 1.5
doug.AR$D13CTissue <- doug.AR$D13CTissue + 1.5
doug.BC$D13CTissue <- doug.BC$D13CTissue + 1.5
doug.NC$D13CTissue <- doug.NC$D13CTissue + 1.5
pipo.OR$D13CTissue <- pipo.OR$D13CTissue + 1.5
pipo.AR$D13CTissue <- pipo.AR$D13CTissue + 1.5
pipo.BC$D13CTissue <- pipo.BC$D13CTissue + 1.5
pipo.NC$D13CTissue <- pipo.NC$D13CTissue + 1.5
# Threshold
npp.threshold <- 0.05
doug.OR[doug.OR$NPP < npp.threshold,] <- NA
doug.AR[doug.AR$NPP < npp.threshold,] <- NA
doug.BC[doug.BC$NPP < npp.threshold,] <- NA
doug.NC[doug.NC$NPP < npp.threshold,] <- NA
pipo.OR[pipo.OR$NPP < npp.threshold,] <- NA
pipo.AR[pipo.AR$NPP < npp.threshold,] <- NA
pipo.BC[pipo.BC$NPP < npp.threshold,] <- NA
pipo.NC[pipo.NC$NPP < npp.threshold,] <- NA