-
Notifications
You must be signed in to change notification settings - Fork 26
Description
Describe the bug
TADA_MediaFilter() inappropriately assigning "GROUNDWATER" flag to all records (including those that have an ActivitySubdivisonName of "Surface Water") in a dataframe returned by TADA_DataRetrieval() using an aoi_sf in the query.
Additional context
I have been routinely using the TADA_MediaFilter() on data queried by my aoi_sf in TADA_DataRetrieval(), as recently as yesterday afternoon (3/11/2026), without issues. TADA_MediaFilter() does behave as expected when using a bound in the query other than aoi_sf, such as state, returning the same records found in the aoi_sf query with a "SURFACE WATER" flag instead of the "GROUNDWATER" flag.
I have tried uninstalling and reinstalling EPATADA but the issue persists.
Code to reproduce the behavior:
#Using R Version 4.5.1
library(EPATADA)
#specify the date range you would like to pull
firstDate <- "2020-02-01" # enter start date for pull (yyyy-mm-dd)
lastDate <- "2020-02-15" #as.character(today()) # uses today's date as the latest date in the pull
#read in shapefile of the area to query for data
pullArea <- read_sf("[location of shapefile]")
#retrieve data from the WQP
dataPull <- TADA_DataRetrieval( startDate = firstDate, endDate = lastDate,
sampleMedia = "Water",
aoi_sf = pullArea,
#state = "MO",
#provider = "",
#huc = "", #could also list out specific HUCs
applyautoclean = TRUE, ask = FALSE)
rm(pullArea)
#filter out everything but surface water
######## this is where the bug is occurring
dataPull2 <- TADA_MediaFilter(dataPull, clean = FALSE, ground_water = TRUE, sediment = TRUE, other = TRUE)