- Notifications
You must be signed in to change notification settings - Fork1
Flow path based nitrogen removal estimation
License
MIT, MIT licenses found
Licenses found
jhollist/nsink
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Thensink
package is an R implementation of the methods described inKellogg et. al (2010).Previous implementation of this approach relied on a manual, vectorbased approach that was time consuming to prepare. This approach uses ahybrid raster-vector approach that takes relatively little time to setup for each new watershed and relies on readily available data. Totalrun times vary, but range from minutes up to 5 hours depending onoptions selected. Previous versions took weeks of manual datamanipulation. Thus,nsink
was developed to satisfy the need forquicker implementation of the NSink method as described inKellogg et.al (2010).
As of 2022-03-14 user functions for thensink
package are:
nsink_get_huc_id()
: A function for searching the name of a USGSWatershed Boundary Dataset Hydrologic Unit(https://www.usgs.gov/core-science-systems/ngp/national-hydrography/watershed-boundary-dataset)and retrieving its 12-digit Hydrologic Unit Code (HUC).nsink_get_data()
: Using any acceptable HUC ID (e.g. 2-digit to12-digit), this function downloads the NHDPlus, SSURGO, NLCD LandCover, and the NLCD Impervious for that HUC.nsink_prep_data()
:nsink
needs data in a common coordinatereference system, from mutliple NHDPlus tables, and from differentportions of SSURGO. This function completes these data preparationsteps and outputs all data, clipped to the HUC boundary.nsink_calc_removal()
: Quantifying relative N removal across alandscape is a key aspects of annsink
analysis. Thensink_calc_removal()
function takes the object returned fromnsink_prep_data()
and calculates relative N removal for eachlandscape sink. See Kellogg et al [-@kellogg2010geospatial] fordetails on relative N removal estimation for each sink.nsink_generate_flowpath()
: This function uses a combination offlow determined by topography, via a flow-direction raster, for theland-based portions of a flow path and of downstream flow along theNHDPlus stream network.nsink_summarize_flowpath()
: Summarizing removal along a specifiedflow path requires relative N removal and a generated flow path.This function uses these and returns a summary of relative N removalalong a flow path for each sink.nsink_generate_static_maps()
: This function analyzes N removal atthe watershed scale by summarizing the results of multiple flowpaths. Four static maps are returned: 1)removal efficiency;2)loading index; 3)transport index; 4)delivery index. Removalefficiency is a rasterized version of thensink_calc_removal()
output. Loading index is N sources based on NLCD categories.Transport index is a heat map with the cumulative relative N removalalong flow paths originating from a grid of points, density set bythe user, across a watershed, highlighting the gradient ofdownstream N retention. Delivery index is the result of multiplyingthe loading index and the transport index, and shows potential Ndelivery from different sources, taking into account the relative Nremoval as water moves downstream.nsink_plot()
: A function that plots each raster in the listreturned fromnsink_generate_static_maps()
.nsink_build()
: One of the drivers behind the development of thensink
package was to providen-sink
analysis output that couldbe used more broadly (e.g. within a GIS). Thensink_build()
runs acompletensink
analysis and outputs R objects, shapefiles and/orTIFFs.nsink_load()
: Essentially the inverse of thensink_build()
function, this function takes a folder of files, likely created bynsink_build()
, and reads them into R.
At this time we plan on maintaining thensink
package as a GitHub onlypackage and thus it won’t be available directly from CRAN. You may usetheinstall_github()
function from theremotes
package to installit. The code below will take care of installingremotes
and installingnsink
from the GitHub repository.
install.packages("remotes")remotes::install_github("usepa/nsink",dependencies=TRUE,build_vignettes=TRUE)
And then to load up the package:
library(nsink)
All functions are documented, with examples, and that documentation maybe accessed, in R, via the usual help functions. Additionally, anintroduction to thensink
package with a more detailed workflow isdocumented in a vignette.
# Load up packagelibrary(nsink)# Access package level helphelp(package="nsink")# Access the Introduction to nsink vignettevignette("intro",package="nsink")
If you would like to contribute to thensink
package, please firstread theCONTRIBUTING. In short,contributions are happily accepted either via suggestions in theIssues or via pull request.
About
Flow path based nitrogen removal estimation