{"id":17121943,"url":"https://github.com/jhollist/nsink","last_synced_at":"2025-04-13T04:52:31.453Z","repository":{"id":50501046,"uuid":"190607176","full_name":"jhollist/nsink","owner":"jhollist","description":"Flow path based nitrogen removal estimation","archived":false,"fork":false,"pushed_at":"2023-04-27T19:32:48.000Z","size":79020,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-13T04:52:25.798Z","etag":null,"topics":["huc","nitrogen","r","raster","rspatial","rstats","spatial","vector"],"latest_commit_sha":null,"homepage":"https://jhollist.github.io/nsink/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jhollist.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-06-06T15:40:51.000Z","updated_at":"2024-01-03T17:35:54.000Z","dependencies_parsed_at":"2023-12-08T10:47:56.710Z","dependency_job_id":null,"html_url":"https://github.com/jhollist/nsink","commit_stats":{"total_commits":298,"total_committers":3,"mean_commits":99.33333333333333,"dds":0.05369127516778527,"last_synced_commit":"8a61adaf5fa2b3d3bbfd122d6c1399661e126a1f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhollist%2Fnsink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhollist%2Fnsink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhollist%2Fnsink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhollist%2Fnsink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jhollist","download_url":"https://codeload.github.com/jhollist/nsink/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665767,"owners_count":21142123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["huc","nitrogen","r","raster","rspatial","rstats","spatial","vector"],"created_at":"2024-10-14T18:04:52.636Z","updated_at":"2025-04-13T04:52:31.428Z","avatar_url":"https://github.com/jhollist.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\ntitle: \"nsink\"\noutput: github_document\n---\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n\u003c!-- badges: start --\u003e\n[![R build status](https://github.com/jhollist/nsink/workflows/R-CMD-check/badge.svg)](https://github.com/jhollist/nsink/actions)\n[![Codecov test coverage](https://codecov.io/gh/jhollist/nsink/branch/main/graph/badge.svg)](https://codecov.io/gh/jhollist/nsink?branch=main)\n[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.6341565.svg)](https://doi.org/10.5281/zenodo.6341565)\n[![DOI](https://joss.theoj.org/papers/10.21105/joss.04039/status.svg)](https://doi.org/10.21105/joss.04039)\n\u003c!-- badges: end --\u003e\n\n# Statement of need\n\nThe `nsink` package is an R implementation of the methods described in [Kellogg et. al (2010)](https://doi.org/10.1016/j.ecoleng.2010.02.006).  Previous implementation of this approach relied on a manual, vector based approach that was time consuming to prepare.  This approach uses a hybrid raster-vector approach that takes relatively little time to set up for each new watershed and relies on readily available data. Total run times vary, but range from minutes up to 5 hours depending on options selected.  Previous versions took weeks of manual data manipulation.  Thus, `nsink` was developed to satisfy the need for quicker implementation of the NSink method as described in [Kellogg et. al (2010)](https://doi.org/10.1016/j.ecoleng.2010.02.006).  \n\n# `nsink` functionality\nAs of `r lubridate::today()` user functions for the `nsink` package are:\n\n- `nsink_get_huc_id()`: A function for searching the name of a USGS Watershed Boundary Dataset Hydrologic Unit (\u003chttps://www.usgs.gov/core-science-systems/ngp/national-hydrography/watershed-boundary-dataset\u003e) and retrieving its 12-digit Hydrologic Unit Code (HUC).  \n- `nsink_get_data()`: Using any acceptable HUC ID (e.g. 2-digit to 12-digit), this function downloads the NHDPlus, SSURGO, NLCD Land Cover, and the NLCD Impervious for that HUC.   \n- `nsink_prep_data()`: `nsink` needs data in a common coordinate reference system, from mutliple NHDPlus tables, and from different portions of SSURGO.  This function completes these data preparation steps and outputs all data, clipped to the HUC boundary.\n- `nsink_calc_removal()`: Quantifying relative N removal across a landscape is a key aspects of an `nsink` analysis.  The `nsink_calc_removal()` function takes the object returned from `nsink_prep_data()` and calculates relative N removal for each landscape sink.  See Kellogg et al [-@kellogg2010geospatial] for details on relative N removal estimation for each sink.\n- `nsink_generate_flowpath()`: This function uses a combination of flow determined by topography, via a flow-direction raster, for the land-based portions of a flow path and of downstream flow along the NHDPlus stream network.   \n- `nsink_summarize_flowpath()`: Summarizing removal along a specified flow path requires relative N removal and a generated flow path.  This function uses these and returns a  summary of relative N removal along a flow path for each sink. \n- `nsink_generate_static_maps()`: This function analyzes N removal at the watershed scale by summarizing the results of multiple flow paths. Four static maps are returned: 1)removal efficiency; 2)loading index; 3)transport index; 4)delivery index.  Removal efficiency is a rasterized version of the `nsink_calc_removal()` output.  Loading index is N sources based on NLCD categories.   Transport index is a heat map with the cumulative relative N removal along flow paths originating from a grid of points, density set by the user, across a watershed, highlighting the gradient of downstream N retention. Delivery index is the result of multiplying the loading index and the transport index, and shows potential N delivery from different sources, taking into account the relative N removal as water moves downstream. \n- `nsink_plot()`: A function that plots each raster in the list returned from `nsink_generate_static_maps()`.   \n- `nsink_build()`: One of the drivers behind the development of the `nsink` package was to provide `n-sink` analysis output that could be used more broadly (e.g. within a GIS).  The `nsink_build()` runs a complete `nsink` analysis and outputs R objects, shapefiles and/or TIFFs.\n- `nsink_load()`: Essentially the inverse of the `nsink_build()` function, this function takes a folder of files, likely created by `nsink_build()`, and reads them into R.\n\n# Installation instructions\n\nAt this time we plan on maintaining the `nsink` package as a GitHub only package and thus it won't be available directly from CRAN.  You may use the `install_github()` function from the `remotes` package to install it.  The code below will take care of installing `remotes` and installing `nsink` from the GitHub repository.\n\n```{r, eval=FALSE}\ninstall.packages(\"remotes\")\nremotes::install_github(\"usepa/nsink\", dependencies = TRUE, build_vignettes = TRUE)\n```\n\nAnd then to load up the package:\n\n```{r eval=FALSE}\nlibrary(nsink)\n```\n\n# Documentation and examples\n\nAll functions are documented, with examples, and that documentation may be accessed, in R, via the usual help functions.  Additionally, an introduction to the `nsink` package with a more detailed workflow is documented in a vignette.  \n\n```{r eval=FALSE}\n# Load up package\nlibrary(nsink)\n\n# Access package level help\nhelp(package = \"nsink\")\n\n# Access the Introduction to nsink vignette\nvignette(\"intro\", package = \"nsink\")\n```\n\n# Contributing\n\nIf you would like to contribute to the `nsink` package, please first read the [CONTRIBUTING](.github/CONTRIBUTING.md).  In short, contributions are happily \naccepted either via suggestions in the \n[Issues](https://github.com/USEPA/nsink/issues) or via pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhollist%2Fnsink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjhollist%2Fnsink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhollist%2Fnsink/lists"}