From 63775d15388d0632a752fcc3e0060d68aebfa017 Mon Sep 17 00:00:00 2001 From: cristinamullin Date: Tue, 14 Nov 2023 16:23:38 -0500 Subject: [PATCH 1/2] add providers input --- R/DataDiscoveryRetrieval.R | 8 ++++++++ man/TADA_DataRetrieval.Rd | 3 +++ 2 files changed, 11 insertions(+) diff --git a/R/DataDiscoveryRetrieval.R b/R/DataDiscoveryRetrieval.R index 02fd9f18..b362d5c8 100644 --- a/R/DataDiscoveryRetrieval.R +++ b/R/DataDiscoveryRetrieval.R @@ -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 @@ -147,6 +148,7 @@ TADA_DataRetrieval <- function(startDate = "null", statecode = "null", organization = "null", project = "null", + providers = "null", applyautoclean = TRUE) { # Set query parameters WQPquery <- list() @@ -215,6 +217,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)) diff --git a/man/TADA_DataRetrieval.Rd b/man/TADA_DataRetrieval.Rd index 3738118f..bf504b72 100644 --- a/man/TADA_DataRetrieval.Rd +++ b/man/TADA_DataRetrieval.Rd @@ -17,6 +17,7 @@ TADA_DataRetrieval( statecode = "null", organization = "null", project = "null", + providers = "null", applyautoclean = TRUE ) } @@ -45,6 +46,8 @@ TADA_DataRetrieval( \item{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} +\item{providers}{Leave blank to include all, or specify "STEWARDS", "STORET" (i.e., WQX), and/or "NWIS".} + \item{applyautoclean}{Logical, defaults to TRUE. Applies TADA_AutoClean function on the returned data profile.} } \value{ From 39d33888725d204d2169f912acc678ce9e0a884b Mon Sep 17 00:00:00 2001 From: cristinamullin Date: Tue, 14 Nov 2023 16:29:57 -0500 Subject: [PATCH 2/2] update docs --- R/DataDiscoveryRetrieval.R | 10 ++++++++++ man/TADA_DataRetrieval.Rd | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/R/DataDiscoveryRetrieval.R b/R/DataDiscoveryRetrieval.R index b362d5c8..82690f96 100644 --- a/R/DataDiscoveryRetrieval.R +++ b/R/DataDiscoveryRetrieval.R @@ -134,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", diff --git a/man/TADA_DataRetrieval.Rd b/man/TADA_DataRetrieval.Rd index bf504b72..16eca1f6 100644 --- a/man/TADA_DataRetrieval.Rd +++ b/man/TADA_DataRetrieval.Rd @@ -169,6 +169,16 @@ tada9 <- TADA_DataRetrieval(organization = c( "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 +) } }