
Match data from the National Land Cover Database to each fish and macroinvertebrate sampling site
getNLCDData.Rd
This function to match watershed-level National Land Cover Database (NLCD) data to each fish and macroinvertebrate sampling site in both space and time by calling StreamCat.
Arguments
- data
Input dataset must include columns for
"SiteNumber"
and"CollectionYear"
.- scale
Scale for NLCD data to be generated. Must be
"Cat"
for catchment or"Ws"
for watershed. SeeDetails
below for more information.- group
logical. Should the NLCD data be grouped into broad categories?
TRUE
orFALSE
. SeeDetails
below for more information.
Value
Function returns a site by year dataframe of NLCD data for either the catchment or watershed scale.
Details
Land-use/land-cover data is extracted from the Multi-Resolution Land Characteristics (MRLC) Consortium National Land Cover Database (NLCD). These LULC data are available in the following years: 2001, 2004, 2006, 2008, 2011, 2013, 2016, and 2019. For years in the input data that are not exact year matches from this list, years are matched to the closest year with NLCD data (e.g. a site sampled in 1995 will have NLCD data from 2001). Note that for samples that fall at the midpoint of two NLCD years (e.g. 2005), the function defaults to the earlier year (e.g. a site sampled in 2005 will have NLCD data from 2004).
Data can be extracted at the catchment ("Cat"
) or watershed ("Ws"
)
scales. The catchment includes land area that drains directly to the sampled
stream segment of the medium-resolution National Hydrography Dataset version
2.(NHDPlusV2), but excludes data from upstream segments. The watershed scale
includes data from the local catchment and from all upstream contributing catchments.
NLCD data can be grouped (group = TRUE
) into five broad categories.
These categories include "water" (grouping of all wetland and open water land
covers), "urban" (grouping of all urban land covers), "forest" (grouping of
deciduous, coniferous, and mixed forests), "open" (grouping of shrub, barren
land, grassland, and hay/pasture), and "crop" (no grouping, just the crop
land use).
The function gathers catchment/watershed NLCD data from the StreamCat database (Hill et al. 2016) via the StreamCat API (https://www.epa.gov/national-aquatic-resource-surveys/streamcat-metrics-rest-api).
References
Hill, Ryan A., Marc H. Weber, Scott G. Leibowitz, Anthony R. Olsen, and Darren J. Thornbrugh, 2016. The Stream-Catchment (StreamCat) Dataset: A Database of Watershed Metrics for the Conterminous United States. Journal of the American Water Resources Association (JAWRA) 52:120-128. DOI: 10.1111/1752-1688.12372.
Examples
if (FALSE) {
## Code to generate the percent land-use/land-cover in the catchment for
## site numbers "USGS-05276005" and "USGS-01390450" from 2007 2008, respectively.
dat = data.frame(SiteNumber = c("USGS-05276005","USGS-01390450"),
CollectionYear = c(2007,2008))
getNLCDData(data=dat,
scale = "Cat",
group = FALSE)
## Code to generate the percent land-use/land-cover in the catchment for
## all samples in the base macroinvertebrate dataset, and grouping those
## LULC data into broad categories.
invertDat1 <- getInvertData()
invertDat1_forNLCD <- invertDat1 %>%
dplyr::select(SiteNumber, CollectionYear)
dat1 = data.frame(invertDat1_forNLCD)
getNLCDData(data=dat1,
scale = "Cat",
group = TRUE)
}