Skip to content

Commit

Permalink
Merge pull request #359 from USEPA/ref-internal-files
Browse files Browse the repository at this point in the history
add provider option to DR
  • Loading branch information
cristinamullin authored Nov 14, 2023
2 parents bd319aa + 39d3388 commit 7695d3f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
18 changes: 18 additions & 0 deletions R/DataDiscoveryRetrieval.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#' @param statecode FIPS state alpha code that identifies a state (e.g. statecode = "DE" for Delaware)
#' @param organization A string of letters and/or numbers (some additional characters also possible) used to signify an organization with data in the Water Quality Portal
#' @param project A string of letters and/or numbers (some additional characters also possible) used to signify a project with data in the Water Quality Portal
#' @param providers Leave blank to include all, or specify "STEWARDS", "STORET" (i.e., WQX), and/or "NWIS".
#' @param applyautoclean Logical, defaults to TRUE. Applies TADA_AutoClean function on the returned data profile.
#'
#' @return TADA-compatible dataframe
Expand Down Expand Up @@ -133,6 +134,16 @@
#' "WNENVDPT_WQX",
#' "PUEBLO_POJOAQUE"
#' ))
#'
#' # query only NWIS data for a 10 year period in CT
#' tada10 = TADA_DataRetrieval(
#' startDate = "2013-01-01",
#' endDate = "2022-12-31",
#' sampleMedia = c("Water", "water"),
#' statecode = "CT", # consider downloading only 1 state at a time
#' providers = "NWIS",
#' applyautoclean = FALSE
#' )
#' }
#'
TADA_DataRetrieval <- function(startDate = "null",
Expand All @@ -147,6 +158,7 @@ TADA_DataRetrieval <- function(startDate = "null",
statecode = "null",
organization = "null",
project = "null",
providers = "null",
applyautoclean = TRUE) {
# Set query parameters
WQPquery <- list()
Expand Down Expand Up @@ -215,6 +227,12 @@ TADA_DataRetrieval <- function(startDate = "null",
} else if (project != "null") {
WQPquery <- c(WQPquery, project = project)
}

if (length(providers) > 1) {
WQPquery <- c(WQPquery, providers = list(providers))
} else if (providers != "null") {
WQPquery <- c(WQPquery, providers = providers)
}

if (length(organization) > 1) {
WQPquery <- c(WQPquery, organization = list(organization))
Expand Down
13 changes: 13 additions & 0 deletions man/TADA_DataRetrieval.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7695d3f

Please sign in to comment.