Skip to contents

The required datasets for the N-sink analysis are available from multiple, online resources. This function takes a HUC as input and downloads local copies of those datasets. It will place these in a local directory and inside that directory a new folder for each NHD Plus raster processing unit will be created. If you use the same folder for the data directory, it will act as a cache (imperfect, though) and only download any new datasets that have not already been downloaded.

Usage

nsink_get_data(
  huc,
  data_dir = normalizePath("nsink_data", winslash = "/", mustWork = FALSE),
  force = FALSE,
  year = "2016"
)

Arguments

huc

A character string of a HUC identifier. Currently can run only a single HUC at a time. This package was developed using 12-digit HUCS, but has been (lightly) tested with larger HUCs and appears to work, but is not certain for all cases.

data_dir

A directory to store N-Sink data downloads. Defaults to "nsink_data" inside of the current working directory. Created if it doesn't exist. May be used for multiple HUCs and only data that doesn't currently exist will be downloaded.

force

Logical to determine if files should be downloaded again if they already exist locally.

year

An argument to be passed to FedData's get_nlcd function. Default is 2016.

Value

Returns a list with the huc used and the directory where the data is stored.

Examples

if (FALSE) {
library(nsink)
niantic_huc <- nsink_get_huc_id("Niantic River")$huc_12
nsink_get_data(huc = niantic_huc, data_dir = "nsink_data", force = TRUE)
}