Skip to contents

This function is a wrapper around the other functions and runs all of those required to build out the full dataset needed for a huc and develops the four static N-Sink maps: the nitrogen loading index, nitrogen removal effeciency, nitrogen transport index, and the nitrogen delivery index. The primary purpose of this is to use the nsink package to develop the required datasets for an nsink application to be built outside of R (e.g. ArcGIS). This will take some time to complete as it is downloading 500-600 Mb of data, processing that data and then creating output files.

Usage

nsink_build(
  huc,
  projection,
  output_dir = normalizePath("nsink_output", winslash = "/", mustWork = FALSE),
  data_dir = normalizePath("nsink_data", winslash = "/", mustWork = FALSE),
  force = FALSE,
  samp_dens = 300,
  year = "2016",
  ...
)

Arguments

huc

A character with the 12 digit HUC ID. May be searched with nsink_get_huc_id

projection

Projection to use for all spatial data, specified as either an EPSG code (as numeric) or WKT (as string).

output_dir

Folder to write processed nsink files to. Currently, the processed files will be overwritten if the same output folder is used. To run different HUC12's specify separate output folders.

data_dir

Folder to hold downloaded data. The same data directory can be used to hold data for multiple HUCs. Data will not be downloaded again if it already exists in this folder.

force

Logical value used to force a new download if data already exists on file system.

samp_dens

The samp_dens controls the density of points to use when creating the nitrogen removal heat map. The area of the watershed is sampled with points that are separated by the samp_dens value, in the units of the input data. The larger the value, the fewer the points.

year

Year argument to be passed to FedData's get_nlcd function. Defaults to 2016.

...

Passes to nsink_calc_removal for the off network arguments: off_network_lakes, off_network_streams, and off_network_canalsditches.

Value

A list providing details on the huc used and the output location of the dataset.

Examples

if (FALSE) {
library(nsink)
aea <- 5072
nsink_build(nsink_get_huc_id("Niantic River")$huc_12, aea,
            output_dir = "nsink_output", data_dir = "nsink_data",
             samp_dens = 600)
}