Skip to contents

Link catchment-based ATTAINS assessment unit data (EPA snapshot of NHDPlus HR catchments associated with entity submitted assessment unit features - points, lines, and polygons) to Water Quality Portal observations, often imported via TADA_DataRetrieval(). This function returns the objects that can be mapped in TADA_ViewATTAINS(). Check out the TADAModule2.Rmd for an example workflow.

Usage

TADA_GetATTAINS(
  .data,
  fill_catchments = FALSE,
  resolution = "Hi",
  return_sf = TRUE
)

Arguments

.data

A dataframe created by TADA_DataRetrieval() or the sf equivalent made by TADA_MakeSpatial().

fill_catchments

Whether the user would like to return NHD catchments for WQP observations not associated with an ATTAINS assessment unit (TRUE or FALSE). Defaults to FALSE.

resolution

If fill_catchments = TRUE, whether to use NHDPlus V2 "Med" catchments or NHDPlus HiRes "Hi" catchments. Default is NHDPlus HiRes ("Hi").

return_sf

Whether to return the associated catchments, lines, points, and polygon shapefile objects along with the data frame(s). TRUE (yes, return) or FALSE (no, do not return). All shapefile features are in WGS84 (crs = 4326). Defaults to TRUE.

Value

A modified TADA_DataRetrieval() dataframe with additional columns associated with the ATTAINS assessment unit data, and, if fill_catchments = TRUE, an additional dataframe of the observations without intersecting ATTAINS features. Moreover, if return_sf = TRUE, this function will additionally return the raw ATTAINS and catchment shapefile features associated with those observations.

Examples

if (FALSE) { # \dontrun{
tada_data <- TADA_DataRetrieval(
  startDate = "2018-05-01",
  endDate = "2018-07-31",
  characteristicName = "pH",
  statecode = "IL",
  applyautoclean = TRUE
)

tada_attains <- TADA_GetATTAINS(tada_data, fill_catchments = FALSE, return_sf = FALSE)

tada_attains_sf <- TADA_GetATTAINS(tada_data, fill_catchments = FALSE, return_sf = TRUE)

tada_attains_filled <- TADA_GetATTAINS(tada_data, fill_catchments = TRUE, resolution = "Hi", return_sf = FALSE)

tada_attains_filled_sf <- TADA_GetATTAINS(tada_data, fill_catchments = TRUE, resolution = "Hi", return_sf = TRUE)

} # }