knitr::opts_chunk$set( echo = TRUE, fig.path="man/figures/README-" ) #devtools::install_github("GuangchuangYu/badger") library(EPGMr) library(rmarkdown) options(continue=" ") options(width=60) library(knitr)
r badger::badge_cran_download("EPGMr", "grand-total", "blue")
Contact Info: Webpage - Twitter - Email
EPGMProfile()
with plots.EPGMProfile()
.EPGMTime()
..Rd
files.This package is an R-version of the original Everglades Phosphorus Gradient Model developed by Walker and Kadlec and implements the model described in:
The model is further discussed in:
Kadlec RH, Walker WW (1999) Management models to evaluate phosphorus impacts on wetlands. In: Reddy KR, O’Conner GA, Schelske CL (eds) Phosphorus Biogeochemistry in Subtropical Ecosystems. Lewis Publishers, Boca Raton, FL, pp 621–639.
Walker WW, Kadlec RH (2011) Modeling Phosphorus Dynamics in Everglades Wetlands and Stormwater Treatment Areas. Critical Reviews in Environmental Science and Technology 41:430–446.
Everglades Phosphorus Gradient Model (EPGM; Fig. 1) predicts variations in water-column phosphorus (P) concentration, peat accretion rate, and soil P concentration along a horizontal gradient imposed by an external P load and sheet-flow conditions. Cattail densities and total areas are predicted based upon correlations with soil P and are surrogates for impacts on ecosystem components which respond to soil P variations in similar concentration ranges. The model is calibrated to soil and vegetation data from Water Conservation Area - 2 (WCA-2; primarily), WCA-1, and WCA-3A. The model successfully simulates observed longitudinal gradients in soil P concentration below the S10 structures in WCA-2A after ~28 years of external P loading (1962 to 1990). Observed expansion of cattail populations in this region between 1973 and 1991 is also simulated, though somewhat over-predicted during the first 20 years. Model results suggest a linear relationship between marsh water-column and soil P concentrations over long time scales. Estimated soil response times range from 20 to 40 years, depending on soil depth, and are inversely related to water-column concentration.
knitr::include_graphics("http://www.wwwalker.net/epgm/epgmpic.gif")
Figure 1: Generalized model structure of the Everglades Phosphorus Gradient Model as originally developed by Walker and Kadlec. The model embodies water and phosphorus mass conservation specific to wetland ecosystems designed for phosphorus management.
A lot of time and effort went into the development of the original EPGM and it is important to give the authors proper credit. This is the ultimate foundation of this R
package.
It also took time in developement of the EPGMr
, translating the spreadsheet model into the R
environment. To see a current citation for EPGMr
, use the following command in R
:
citation('EPGMr')
install.packages("devtools");# if you do not have it installed on your PC devtools::install_github("SwampThingPaul/EPGMr")
For the examples below we are going to use an internal dataset within this package. This is also the data provided in the orginal EPGM as case study examples. To see these data use the data()
function. This internal package data is a table of variables from data provided in the original EPGM model. This data (and the original) has 12 examples (cases) of phosphorus inputs, hydrologic information (inflow volume, rainfall, evapotranspiration and hydroperiod), soil depth of interest, soil characteristics, and soil gradient values. Examples include dicharges from Stormwater Treatment Area (STA) 2, 3/4, 5, 6 and the S10 structures.
data("casedat")
Case number 11 is data from the S10 structures that discharge into northeast Water Conservation area 2A, the historic eutrophication gradient within the Everglades ecosystem.
#I transposed the data for easy viewing. t(casedat[casedat$case.number==11,])
EPGMr
is broken into three functions.
EPGMProfile
simulates the phopshorus gradient (distance downstream) during a specified simulation period (default: 30 years). The function as defaulted also provides a summary results output and plot of water column total P, soil P and cattail density along the gradient. Graphical output includes steady state simulation and time at the simulation period (default: 30 years).
EPGMTime
uses EPGMProfile
to simulate yearly P dynamics along the gradient for a specified period (default: 200 years) thereby simulating changes in P along the gradient over time. Similar to EPGMProfile
as defaulted a summary table is provided based on distance intervals specified in the Dist.slice
argument in the function (default is c(0,0.5,1,2,5,10)
). Also as a default a series of time plots are generated for soil P and cattail density.
EPGMThreshold
evaluates raw outputs from EPGMTime
relative to thresholds for water column, soil and cattail density. As a default it provides a summary table and plot.
This will run the example case number 11, plot the distance profile depicited below and provide a summary results table. If raw.output
was set to TRUE
, the raw data behind the plots and summary tables would be printed in the console. If results.table
was set to TRUE
then a summary results table will be printed (default). The results output table under $DistanceProfile
provides a summary of the simulation period at several user input distances, however the default argument in the function is summary.distance=c(0,0.5,1,2,4,8,10)
. Other information in the summary result tab include, simulation inputs, water budget, phosphorus mass balance and information on regarding soils for the simulation period (default is 30 years).
EPGMProfile(case.no=11,plot.profile=TRUE,summary.distance=c(0,1,2,4,10))
This function will run the EPGM model over a determined period of time (with specificied time increment). If raw.time.output
is set to TRUE
, the raw data behind the plots and summary tables will be printed in the console and/or saved as an object. This will results in a data.frame
with data specific to space (i.e. distance) and time (i.e. year).
EPGMTime(case.no=11)
This function will calculate, summarise and plot area exceedance for results from EPGMTime()
. Currently the function is configured to evaluate three threshold for water column, soil and cattail density within the modelled flow-path. Much like the other functions, If raw.area.output
is set to TRUE
, then the raw results summarized in the summary table and plots will be provided as a data.frame
.
example<-EPGMTime(case.no=11,raw.time.output=TRUE,plot.profile=FALSE) EPGMThreshold(example)
Below is an example of the EPGMProfile
function with user input data rather than case specific data.
#User defined inputs Discharge.Yr <- 1962 Out.TPconc <- 122 out.Q <- 281.3 FP.width <- 10.5 HP.per <- 91.4 Soil.z <- 10 Soil.BDi <- 0.102 Soil.TPi <- 198 TPGradient.i <- -0.0018 Soil.BDf <- 0.08 k <- 10.2 P.dep <- 42.9 RF <- 1.23 ET <- 1.38 EPGMProfile( Start.Discharge = Discharge.Yr, STA.outflow.TPconc = Out.TPconc, STA.outflow.vol = out.Q, FlowPath.width = FP.width, Hydroperiod = HP.per, Soil.Depth = Soil.z, Soil.BulkDensity.initial = Soil.BDi, Soil.TPConc.initial = Soil.TPi, Vertical.SoilTPGradient.initial = TPGradient.i, Soil.BulkDensity.final = Soil.BDf, PSettlingRate = k, P.AtmoDep = P.dep, Rainfall = RF, ET = ET, summary.distance=c(0,1,5,10))
EPGMProfile(case.no=14)
raw.output=TRUE
and results.table=TRUE
at its current stands the function will default to the results table and plot with a warning. EPGMProfile( case.no=11, summary.distance=c(0,1,5,10), raw.output=TRUE, results.table=TRUE)
Dist.increment.km
is greater than the Max.Dist
arguments, the function will stop and provide a warning. EPGMProfile( case.no=11, Dist.increment.km=16, Max.Dist=15)
summary.distance
values must be positve, so can't back look behind the discharge with this model.EPGMProfile( case.no=11, summary.distance=-1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.