knitr::opts_chunk$set(echo = TRUE)

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.

Installation

Install r3PG from GitHub using devtools.

devtools::install_github(repo = "griffithdan/r3PG")
library(r3PG)

Load example climate data

The "r3PG" R package has monthly climate normals available for four example sites.

data("clim.WesternOR", "clim.Argentina", "clim.NorthCarolina", "clim.BritishColumbia")
par(mfrow = c(1,2), mar = c(5, 4, 1, 2) + 0.1)

  with(clim.WesternOR, plot(Tav ~ c(1:12), type = "l", xlab = "", ylim = c(-10,30), 
                            xaxt = "n", col = "dodgerblue", ylab = expression(paste("Mean Temperature (",degree,C,")", sep = ""))))
    with(clim.Argentina, lines(y = Tav, x = c(1:12), col = "darkorange"))    
    with(clim.BritishColumbia, lines(y = Tav, x = c(1:12), col = "darkgreen"))    
    with(clim.NorthCarolina, lines(y = Tav, x = c(1:12), col = "purple"))    
        axis(side = 1, at = c(1:12), labels = month.abb, las = 2)

  with(clim.WesternOR, plot(Rain ~ c(1:12), type = "l", xlab = "", ylim = c(0,400), 
                            xaxt = "n", col = "dodgerblue", ylab = expression("Rain (mm)")))
    with(clim.Argentina, lines(y = Rain, x = c(1:12), col = "darkorange"))    
    with(clim.BritishColumbia, lines(y = Rain, x = c(1:12), col = "darkgreen"))    
    with(clim.NorthCarolina, lines(y = Rain, x = c(1:12), col = "purple"))    
        axis(side = 1, at = c(1:12), labels = month.abb, las = 2)

  legend("topright", legend = c("Western OR","Argentina","British Columbia","North Carolina"), lwd = 1, lty = 1, col = c("dodgerblue","darkorange","darkgreen","purple"))

Load example configuration data

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")
  par(mar = c(5, 4, 1, 2) + 0.1)

# What parameters are different between Douglas fir and Ponderosa pine.
  parameters <- names(unlist(cfg.Pseudotsuga.menziesii))
  spp_parameters <- unlist(cfg.Pseudotsuga.menziesii) != unlist(cfg.Pinus.ponderosa)
  douglas.fir <- as.numeric(unlist(cfg.Pseudotsuga.menziesii)[spp_parameters])
  ponderosa.pine <- as.numeric(unlist(cfg.Pinus.ponderosa)[spp_parameters])
  paramlabs <- names(unlist(cfg.Pinus.ponderosa)[spp_parameters])
    paramlabs <- unlist(lapply(X = strsplit(split = "\\.", paramlabs), FUN = function(x){x[2]}))
  plot(log(douglas.fir) ~ c(1:length(douglas.fir)), xaxt = "n", ylab = "log(parameter value)", xlab = "", pch = 21, bg = "dodgerblue", cex = 1)
    points(y = log(ponderosa.pine),x = c(1:length(ponderosa.pine)), xaxt = "n", ylab = "", xlab = "", pch = 21, bg = "darkorange", cex = 1)
            axis(side = 1, at = c(1:length(ponderosa.pine)), labels = paramlabs, las = 2)

  legend("topleft", pch = 21,
         legend = c("Douglas fir","Ponderosa pine"), 
         pt.bg = c("dodgerblue","darkorange"))

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

Run the 3PG model for two species in four climates

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

Plot D13C by site and species

par(mfrow = c(2,2), mar = c(2.5,4,3,1))

  with(tail(doug.OR, 12), plot(D13CTissue ~ c(1:12), ylim = c(-32, -20), type = "l", xlab = "", main = "Western OR", xaxt = "n", col = "dodgerblue", ylab = expression(Wood ~{delta}^13*C~'\211')))
    with(tail(pipo.OR, 12), lines(y = D13CTissue, x = c(1:12), col = "darkorange"))    
    axis(side = 1, at = c(1:12), labels = month.abb, las = 2)

  with(tail(doug.AR, 12), plot(D13CTissue ~ c(1:12), ylim = c(-32, -20), type = "l", xlab = "", main = "Argentina", xaxt = "n", col = "dodgerblue", ylab = expression(Wood ~{delta}^13*C~'\211')))
    with(tail(pipo.AR, 12), lines(y = D13CTissue, x = c(1:12), col = "darkorange"))    
    axis(side = 1, at = c(1:12), labels = month.abb, las = 2)

  with(tail(doug.BC, 12), plot(D13CTissue ~ c(1:12), ylim = c(-32, -20), type = "l", xlab = "", main = "British Columbia", xaxt = "n", col = "dodgerblue", ylab = expression(Wood ~{delta}^13*C~'\211')))
    with(tail(pipo.BC, 12), lines(y = D13CTissue, x = c(1:12), col = "darkorange"))    
    axis(side = 1, at = c(1:12), labels = month.abb, las = 2)

  with(tail(doug.NC, 12), plot(D13CTissue ~ c(1:12), ylim = c(-32, -20), type = "l", xlab = "", main = "North Carolina", xaxt = "n", col = "dodgerblue", ylab = expression(Wood ~{delta}^13*C~'\211')))
    with(tail(pipo.NC, 12), lines(y = D13CTissue, x = c(1:12), col = "darkorange"))    
    axis(side = 1, at = c(1:12), labels = month.abb, las = 2)

    legend("topright", legend = c("Douglas fir","Ponderosa pine"), lwd = 1, lty = 1, col = c("dodgerblue","darkorange"))    

References

Landsberg, J.J., and R.H. Waring. "A Generalised Model of Forest Productivity Using Simplified Concepts of Radiation-Use Efficiency, Carbon Balance and Partitioning." Forest Ecology and Management 95, no. 3 (August 1997): 209-28. https://doi.org/10.1016/S0378-1127(97)00026-1.

Wei, Liang, John D. Marshall, Jianwei Zhang, Hang Zhou, and Robert F. Powers. "3-PG Simulations of Young Ponderosa Pine Plantations under Varied Management Intensity: Why Do They Grow so Differently?" Forest Ecology and Management 313 (February 2014): 69-82. https://doi.org/10.1016/j.foreco.2013.10.035.



griffithdan/r3PG documentation built on May 17, 2019, 8:37 a.m.