diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index 38eef4ab..06e731e8 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -74,7 +74,8 @@ jobs: - name: Build site run: | pkgdown::build_site(override = list(destination = "public")) | - file.copy(from = "./public/articles/logo.png",to = "./public/reference/logo.png") + file.copy(from = "./public/articles/logo.png",to = "./public/reference/logo.png") | + file.copy(from = "./public/articles/logo.png", to = "./public/news/logo.png") shell: Rscript {0} - name: Set up Quarto uses: quarto-dev/quarto-actions/setup@v2 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 565ddcb1..660a9475 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -141,7 +141,8 @@ pages: - | Rscript -e ' pkgdown::build_site(override = list(destination = "public")) - file.copy(from = "./public/articles/logo.png", to = "./public/reference/logo.png")' + file.copy(from = "./public/articles/logo.png", to = "./public/reference/logo.png") + file.copy(from = "./public/articles/logo.png", to = "./public/news/logo.png")' - quarto render artifacts: paths: diff --git a/NAMESPACE b/NAMESPACE index 58e18e70..47f4a228 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -23,6 +23,7 @@ export(importWQP) export(importWaterML1) export(importWaterML2) export(is_dataRetrieval_user) +export(make_monitoring_location_arguments) export(pCodeToName) export(parameterCdFile) export(parse_WQP) diff --git a/NEWS b/NEWS.md similarity index 94% rename from NEWS rename to NEWS.md index 19d5dcc0..a7d1824f 100644 --- a/NEWS +++ b/NEWS.md @@ -2,8 +2,12 @@ dataRetrieval 2.7.26 =================== * Added suite of read_ngwmn to access new National Groundwater Monitoring Network API. -* Added read_waterdata_use to access USGS's National Water Availability -Assessment Data Companion API service. +* Added read_wateruse to access USGS's National Water Availability Assessment Data Companion API service. +* Created make_monitoring_location_arguments to help users understand +what new optional arguments are available in many of the read_waterdata functions. +* Added ability to use `...` in the Water Data functions for: daily, latest-continuous, field-measurements, latest-daily, latest-field-measurements, continuous, and peaks. The "..." argument can now accept any parameter that is output from the make_monitoring_location_arguments function. +* Added "q" argument to read_waterdata_monitoring_location. Full-text search across the most relevant text fields for this collection (e.g. site name, identifier, number, state, county, and site type). +* Added "skipGeometry" argument to read_waterdata_continuous. Previously geometry wasn't included with continuous data, but now is supported. dataRetrieval 2.7.25 =================== diff --git a/R/get_ogc_data.R b/R/get_ogc_data.R index 6b2af8c4..87be4141 100644 --- a/R/get_ogc_data.R +++ b/R/get_ogc_data.R @@ -54,13 +54,14 @@ get_ogc_data <- function(args, output_id, service, base = "OGC") { return_list <- walk_pages(req) } - return_list <- deal_with_empty(return_list = return_list, - properties = args[["properties"]], - service = service, - skipGeometry = isTRUE(args[["skipGeometry"]]), - convertType = args[["convertType"]], - no_paging = no_paging, - base = base + return_list <- deal_with_empty( + return_list = return_list, + properties = args[["properties"]], + service = service, + skipGeometry = isTRUE(args[["skipGeometry"]]), + convertType = args[["convertType"]], + no_paging = no_paging, + base = base ) return_list <- rejigger_cols(return_list, args[["properties"]], output_id) @@ -217,46 +218,19 @@ switch_properties_id <- function(properties, id) { #' the default for time series functions is #' `r getOption("dataRetrieval.site_chunk_size_data")`. #' Setting to `NA` will eliminate site chunking, giving users full control. -#' @param \dots Not used. Included to help differentiate official Water Data API arguments -#' from more seldom used, optional dataRetrieval-specific arguments. #' @keywords internal check_arguments_non_api <- function( convertType, no_paging, limit, attach_request, - chunk_size, - ... + chunk_size ) { - if (!is.null(convertType)) { - if (!is.na(convertType) & !is.logical(convertType)) { - stop("convertType should be a logical TRUE/FALSE") - } - } - - if (!is.null(no_paging)) { - if (!is.na(no_paging) & !is.logical(no_paging)) { - stop("no_paging should be a logical TRUE/FALSE") - } - } - - if (!is.null(attach_request)) { - if (!is.na(attach_request) & !is.logical(attach_request)) { - stop("attach_request should be a logical TRUE/FALSE") - } - } - - if (!is.null(limit)) { - if (!is.na(limit) & !is.numeric(limit)) { - stop("limit should be an integer") - } - } - - if (!is.null(chunk_size)) { - if (!is.na(chunk_size) & !is.numeric(chunk_size)) { - stop("chunk_size should be an integer") - } - } + check_logical(convertType, "convertType") + check_logical(no_paging, "no_paging") + check_logical(attach_request, "attach_request") + check_integer(limit, "limit") + check_integer(chunk_size, "chunk_size") } #' Check other arguments @@ -276,11 +250,7 @@ check_arguments_non_api <- function( #' #' @keywords internal check_arguments_api <- function(bbox, skipGeometry) { - if (!is.null(skipGeometry)) { - if (!is.na(skipGeometry) & !is.logical(skipGeometry)) { - stop("skipGeometry should be a logical TRUE/FALSE") - } - } + check_logical(skipGeometry, "skipGeometry") if (!is.null(bbox)) { if (!all(is.na(bbox))) { diff --git a/R/make_monitoring_location_arguments.R b/R/make_monitoring_location_arguments.R new file mode 100644 index 00000000..769163c8 --- /dev/null +++ b/R/make_monitoring_location_arguments.R @@ -0,0 +1,204 @@ +#' Get Monitoring Location Arguments +#' +#' Many read_waterdata functions have a long list of arguments that can be used +#' to find sites that have data. Users can use this function to create a list +#' of possible arguments that can be used as input to the `monitoring_location_arguments` +#' argument (found in many of the read_waterdata functions). This function +#' also is used to check that user supplied available parameters to their queries +#' when using the `monitoring_location_arguments` argument. +#' +#' @param service Endpoint to check arguments against. Possible values are +#' "daily", "latest-continuous", "field-measurements", "latest-daily", +#' "latest-field-measurements", "continuous", "peaks". +#' @param agency_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$agency_code$description` +#' @param agency_name `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$agency_name$description` +#' @param monitoring_location_number `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$monitoring_location_number$description` +#' @param monitoring_location_name `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$monitoring_location_name$description` +#' @param district_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$district_code$description` +#' @param country_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$country_code$description` +#' @param country_name `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$country_name$description` +#' @param state_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$state_code$description` +#' @param state_name `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$state_name$description` +#' @param county_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$county_code$description` +#' @param county_name `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$county_name$description` +#' @param minor_civil_division_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$minor_civil_division_code$description` +#' @param site_type_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$site_type_code$description` +#' @param site_type `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$site_type$description` +#' @param hydrologic_unit_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$hydrologic_unit_code$description` +#' @param basin_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$basin_code$description` +#' @param altitude `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$altitude$description` +#' @param altitude_accuracy `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$altitude_accuracy$description` +#' @param altitude_method_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$altitude_method_code$description` +#' @param altitude_method_name `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$altitude_method_name$description` +#' @param vertical_datum `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$vertical_datum$description` +#' @param vertical_datum_name `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$vertical_datum_name$description` +#' @param horizontal_positional_accuracy_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$horizontal_positional_accuracy_code$description` +#' @param horizontal_positional_accuracy `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$agency_code$description` +#' @param horizontal_position_method_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$horizontal_position_method_code$description` +#' @param horizontal_position_method_name `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$horizontal_position_method_name$description` +#' @param original_horizontal_datum `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$original_horizontal_datum$description` +#' @param original_horizontal_datum_name `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$original_horizontal_datum_name$description` +#' @param drainage_area `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$drainage_area$description` +#' @param contributing_drainage_area `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$contributing_drainage_area$description` +#' @param time_zone_abbreviation `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$time_zone_abbreviation$description` +#' @param uses_daylight_savings `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$agency_code$description` +#' @param construction_date `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$construction_date$description` +#' @param aquifer_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$aquifer_code$description` +#' @param national_aquifer_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$national_aquifer_code$description` +#' @param aquifer_type_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$agency_code$description` +#' @param well_constructed_depth `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$well_constructed_depth$description` +#' @param hole_constructed_depth `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$hole_constructed_depth$description` +#' @param depth_source_code `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$depth_source_code$description` +#' @param data_gap_interval `r check_OGC_requests(endpoint = "daily", type = "queryables")$properties$data_gap_interval$description` +#' @param \dots Not used. Used to make sure the user isn't passing in arguments that aren't available. +#' @param check_arguments Logical. Used to decide if the arguments passed in are available or not. The +#' default is `FALSE`. Using `TRUE` will make two calls to the API, so if you are concerned +#' with minimizing API calls, keep this value as `FALSE`. If you are concerned with +#' making sure your calls are accepted by the service, set to `TRUE`. +#' @export +#' @examples +#' +#' make_monitoring_location_arguments(service = "daily", agency_name = "USGS") +#' make_monitoring_location_arguments(service = "field-measurements", +#' state_name = c("Ohio", "Wisconsin")) +make_monitoring_location_arguments <- function( + service = "daily", + agency_code = NA_character_, + agency_name = NA_character_, + monitoring_location_number = NA_character_, + monitoring_location_name = NA_character_, + district_code = NA_character_, + country_code = NA_character_, + country_name = NA_character_, + state_code = NA_character_, + state_name = NA_character_, + county_code = NA_character_, + county_name = NA_character_, + minor_civil_division_code = NA_character_, + site_type_code = NA_character_, + site_type = NA_character_, + hydrologic_unit_code = NA_character_, + basin_code = NA_character_, + altitude = NA_character_, + altitude_accuracy = NA_character_, + altitude_method_code = NA_character_, + altitude_method_name = NA_character_, + vertical_datum = NA_character_, + vertical_datum_name = NA_character_, + horizontal_positional_accuracy_code = NA_character_, + horizontal_positional_accuracy = NA_character_, + horizontal_position_method_code = NA_character_, + horizontal_position_method_name = NA_character_, + original_horizontal_datum = NA_character_, + original_horizontal_datum_name = NA_character_, + drainage_area = NA_character_, + contributing_drainage_area = NA_character_, + time_zone_abbreviation = NA_character_, + uses_daylight_savings = NA_character_, + construction_date = NA_character_, + aquifer_code = NA_character_, + national_aquifer_code = NA_character_, + aquifer_type_code = NA_character_, + well_constructed_depth = NA_character_, + hole_constructed_depth = NA_character_, + depth_source_code = NA_character_, + data_gap_interval = NA_character_, + ..., + check_arguments = FALSE +) { + # Make sure no one passes in an argument that's not suppose to be there + rlang::check_dots_empty() + service_with_extra_queries <- c( + "daily", + "latest-continuous", + "field-measurements", + "latest-daily", + "latest-field-measurements", + "continuous", + "peaks" + ) + match.arg(service, choices = service_with_extra_queries, several.ok = FALSE) + + args <- mget(names(formals())) + args[["..."]] <- NULL + args[["service"]] <- NULL + args[["check_arguments"]] <- NULL + + n_args <- names(args) + + lapply(n_args, function(x) { + check_character(args[[x]], x) + }) + + if (check_arguments) { + # think about if we want this as an option + # don't want to waste a lot of hits to the API if people are + # running into their token limits + properties <- dataRetrieval::get_ogc_params(service) + queryables <- check_OGC_requests(endpoint = service, type = "queryables") + non_returned <- queryables$properties[ + !names(queryables$properties) %in% names(properties) + ] + + args_not_available <- args[!names(args) %in% names(non_returned)] + if (length(args_not_available) > 0) { + message( + "The ", + service, + " service doesn't accept: ", + paste0(names(args_not_available), collapse = ", "), + "." + ) + message("Those arguments will be ignored.") + } + + args <- args[names(args) %in% names(non_returned)] + } + + return(args) +} + +cleanup_arguments <- function(args, monitoring_location_arguments, service) { + query_args <- do.call( + make_monitoring_location_arguments, + c(monitoring_location_arguments, service = service) + ) + + args[["monitoring_location_arguments"]] <- NULL + args[["..."]] <- NULL + args <- c(args, query_args) + + return(args) +} + +check_character <- function(x, name) { + if (!is.null(x)) { + if (all(!is.na(x) & !is.character(x))) { + stop(paste(name, "should be a character")) + } + } +} + +check_numeric <- function(x, name) { + if (!is.null(x)) { + if (all(!is.na(x) & !is.numeric(x))) { + stop(paste(name, "should be a numeric")) + } + } +} + +check_integer <- function(x, name) { + if (!is.null(x)) { + if (all(!is.na(x) & !is.numeric(x))) { + stop(paste(name, "should be a integer")) + } + } +} + +check_logical <- function(x, name) { + if (!is.null(x)) { + if (all(!is.na(x) & !is.logical(x))) { + stop(paste(name, "should be a logical (TRUE/FALSE)")) + } + } +} diff --git a/R/read_ngwmn_lithology.R b/R/read_ngwmn_lithology.R index 032352b8..d4092fd3 100644 --- a/R/read_ngwmn_lithology.R +++ b/R/read_ngwmn_lithology.R @@ -11,6 +11,8 @@ #' Available options are: #' `r dataRetrieval:::get_properties_for_docs("lithologyObs", base = "NGWMN")`. #' The default (`NA`) will return all columns of the data. +#' @param \dots Not used. Included to help differentiate official NGWMN API arguments +#' from more seldom used, optional dataRetrieval-specific arguments. #' @inheritParams check_arguments_non_api #' #' @examplesIf is_dataRetrieval_user() @@ -38,12 +40,12 @@ read_ngwmn_lithology <- function( attach_request = getOption("dataRetrieval.attach_request") ) { service <- "lithologyObs" - + # Check for mandatory arguments: - if(all(is.na(monitoring_location_id))){ + if (all(is.na(monitoring_location_id))) { stop("monitoring_location_id is a mandatory argument.") } - + rlang::check_dots_empty() args <- mget(names(formals())) diff --git a/R/read_ngwmn_providers.R b/R/read_ngwmn_providers.R index ae322fdc..d3740e60 100644 --- a/R/read_ngwmn_providers.R +++ b/R/read_ngwmn_providers.R @@ -13,6 +13,8 @@ #' Available options are: #' `r dataRetrieval:::get_properties_for_docs("providers", base = "NGWMN")`. #' The default (`NA`) will return all columns of the data. +#' @param \dots Not used. Included to help differentiate official NGWMN API arguments +#' from more seldom used, optional dataRetrieval-specific arguments. #' @inheritParams check_arguments_non_api #' #' @examplesIf is_dataRetrieval_user() diff --git a/R/read_ngwmn_sites.R b/R/read_ngwmn_sites.R index c8eb3857..961900a4 100644 --- a/R/read_ngwmn_sites.R +++ b/R/read_ngwmn_sites.R @@ -68,7 +68,8 @@ #' depth). Coordinates are assumed to be in crs 4326. The expected format is a numeric #' vector structured: c(xmin,ymin,xmax,ymax). Another way to think of it is c(Western-most longitude, #' Southern-most latitude, Eastern-most longitude, Northern-most longitude). -#' +#' @param \dots Not used. Included to help differentiate official NGWMN API arguments +#' from more seldom used, optional dataRetrieval-specific arguments. #' @inheritParams check_arguments_non_api #' @examplesIf is_dataRetrieval_user() #' diff --git a/R/read_ngwmn_water_level.R b/R/read_ngwmn_water_level.R index 307930e9..6bfc3778 100644 --- a/R/read_ngwmn_water_level.R +++ b/R/read_ngwmn_water_level.R @@ -24,12 +24,13 @@ #' #' @param datetime #' `r get_ogc_params("waterLevelObs", base = "NGWMN")$sample_time$description` -#' +#' #' @param properties A vector of requested columns to be returned from the query. #' Available options are: #' `r dataRetrieval:::get_properties_for_docs("waterLevelObs", base = "NGWMN")`. #' The default (`NA`) will return all columns of the data. -#' +#' @param \dots Not used. Included to help differentiate official NGWMN API arguments +#' from more seldom used, optional dataRetrieval-specific arguments. #' @inheritParams check_arguments_non_api #' #' @examplesIf is_dataRetrieval_user() @@ -68,12 +69,12 @@ read_ngwmn_water_level <- function( attach_request = getOption("dataRetrieval.attach_request") ) { service <- "waterLevelObs" - + # Check for mandatory arguments: - if(all(is.na(monitoring_location_id))){ + if (all(is.na(monitoring_location_id))) { stop("monitoring_location_id is a mandatory argument.") } - + rlang::check_dots_empty() args <- mget(names(formals())) diff --git a/R/read_ngwmn_well_construction.R b/R/read_ngwmn_well_construction.R index 6e11c586..3caa5a3a 100644 --- a/R/read_ngwmn_well_construction.R +++ b/R/read_ngwmn_well_construction.R @@ -13,6 +13,8 @@ #' Available options are: #' `r dataRetrieval:::get_properties_for_docs("constructionObs", base = "NGWMN")`. #' The default (`NA`) will return all columns of the data. +#' @param \dots Not used. Included to help differentiate official NGWMN API arguments +#' from more seldom used, optional dataRetrieval-specific arguments. #' @inheritParams check_arguments_non_api #' #' @examplesIf is_dataRetrieval_user() @@ -43,10 +45,10 @@ read_ngwmn_well_construction <- function( ) { service <- "constructionObs" # Check for mandatory arguments: - if(all(is.na(monitoring_location_id))){ + if (all(is.na(monitoring_location_id))) { stop("monitoring_location_id is a mandatory argument.") } - + rlang::check_dots_empty() args <- mget(names(formals())) diff --git a/R/read_waterdata_channel.R b/R/read_waterdata_channel.R index 74e92840..74fbdb9d 100644 --- a/R/read_waterdata_channel.R +++ b/R/read_waterdata_channel.R @@ -34,6 +34,8 @@ #' Available options are: #' `r dataRetrieval:::get_properties_for_docs("channel-measurements", "channel_measurements_id")`. #' The default (`NA`) will return all columns of the data. +#' @param \dots Not used. Included to help differentiate official Water Data API arguments +#' from more seldom used, optional dataRetrieval-specific arguments. #' @inheritParams check_arguments_api #' @inheritParams check_arguments_non_api #' diff --git a/R/read_waterdata_combined_meta.R b/R/read_waterdata_combined_meta.R index de173e1d..b84e76b8 100644 --- a/R/read_waterdata_combined_meta.R +++ b/R/read_waterdata_combined_meta.R @@ -82,6 +82,8 @@ #' Available options are: #' `r dataRetrieval:::get_properties_for_docs("combined-metadata", "field_measurement_id")`. #' The default (`NA`) will return all columns of the data. +#' @param \dots Not used. Included to help differentiate official Water Data API arguments +#' from more seldom used, optional dataRetrieval-specific arguments. #' @inheritParams check_arguments_api #' @inheritParams check_arguments_non_api #' @inherit read_waterdata_continuous details diff --git a/R/read_waterdata_continuous.R b/R/read_waterdata_continuous.R index eff8cc87..8d0aca64 100644 --- a/R/read_waterdata_continuous.R +++ b/R/read_waterdata_continuous.R @@ -6,7 +6,7 @@ #' a single request. If no "time" is specified, the service will return the #' last single year of data. If this is a bottleneck, please check back #' for new direct download functions that are expected to be available sometime -#' in 2026. +#' in 2027. #' #' #' @export @@ -31,8 +31,11 @@ #' Available options are: #' `r dataRetrieval:::get_properties_for_docs("continuous", "continuous_id")`. #' The default (`NA`) will return all columns of the data. -#' @param \dots Not used. Included to help differentiate official Water Data API arguments -#' from more seldom used, optional dataRetrieval-specific arguments. +#' @param \dots Arguments that can be queried, +#' but are not returned. These are used as alternatives to specifying specific +#' monitoring_location_ids. See `make_monitoring_location_arguments()` +#' to get a list of all possible arguments available. +#' @seealso [make_monitoring_location_arguments()] #' @inheritParams check_arguments_non_api #' @inheritParams check_arguments_api #' @@ -76,6 +79,12 @@ #' parameter_code = c("00060", "72019"), #' last_modified = "P7D") #' +#' dane <- read_waterdata_continuous( +#' state_name = "Wisconsin", +#' county_name = "Dane County", +#' parameter_code = "00060", +#' time = "P1D") +#' #' # how to split up request into roughly 3 year chunks #' #' site <- "USGS-0208458892" @@ -131,10 +140,15 @@ read_waterdata_continuous <- function( ) { service <- "continuous" output_id <- "continuous_id" - rlang::check_dots_empty() args <- mget(names(formals())) + args <- cleanup_arguments( + args = args, + monitoring_location_arguments = list(...), + service = service + ) + return_list <- get_ogc_data(args, output_id, service) attr(return_list$time, "tzone") <- "UTC" diff --git a/R/read_waterdata_daily.R b/R/read_waterdata_daily.R index 13922ae1..8eb34ba6 100644 --- a/R/read_waterdata_daily.R +++ b/R/read_waterdata_daily.R @@ -25,10 +25,13 @@ #' Available options are: #' `r dataRetrieval:::get_properties_for_docs("daily", "daily_id")`. #' The default (`NA`) will return all columns of the data. -#' +#' @param \dots Arguments that can be queried, +#' but are not returned. These are used as alternatives to specifying specific +#' monitoring_location_ids. See `make_monitoring_location_arguments()` +#' to get a list of all possible arguments available. #' @inheritParams check_arguments_api #' @inheritParams check_arguments_non_api -#' +#' @seealso [make_monitoring_location_arguments()] #' @inherit read_waterdata_continuous details #' #' @examplesIf is_dataRetrieval_user() @@ -73,6 +76,13 @@ #' dv_data_no_request <- read_waterdata_daily(monitoring_location_id = site, #' parameter_code = "00060", #' time = c("2021-01-01", "2022-01-01")) +#' +#' dv_dane <- read_waterdata_daily( +#' state_name = "Wisconsin", +#' county_name = "Dane County", +#' parameter_code = "00060", +#' time = "P7D") +#' #' } read_waterdata_daily <- function( monitoring_location_id = NA_character_, @@ -97,9 +107,15 @@ read_waterdata_daily <- function( ) { service <- "daily" output_id <- "daily_id" - rlang::check_dots_empty() args <- mget(names(formals())) + + args <- cleanup_arguments( + args = args, + monitoring_location_arguments = list(...), + service = service + ) + return_list <- get_ogc_data(args, output_id, service, base = "OGC") return(return_list) diff --git a/R/read_waterdata_field_measurements.R b/R/read_waterdata_field_measurements.R index 25d82256..c994aa5d 100644 --- a/R/read_waterdata_field_measurements.R +++ b/R/read_waterdata_field_measurements.R @@ -37,8 +37,13 @@ #' Available options are: #' `r dataRetrieval:::get_properties_for_docs("field-measurements", "field_measurement_id")`. #' The default (`NA`) will return all columns of the data. +#' @param \dots Arguments that can be queried, +#' but are not returned. These are used as alternatives to specifying specific +#' monitoring_location_ids. See `make_monitoring_location_arguments()` +#' to get a list of all possible arguments available. #' @inheritParams check_arguments_api #' @inheritParams check_arguments_non_api +#' @seealso [make_monitoring_location_arguments()] #' #' @inherit read_waterdata_continuous details #' @@ -81,6 +86,12 @@ #' time = "2024-07-01T00:00:00Z/..", #' parameter_code = "00060") #' +#' dane <- read_waterdata_field_measurements( +#' state_name = "Wisconsin", +#' county_name = "Dane County", +#' parameter_code = "00060", +#' time = "P30D") +#' #' #' } read_waterdata_field_measurements <- function( @@ -112,9 +123,15 @@ read_waterdata_field_measurements <- function( ) { service <- "field-measurements" output_id <- "field_measurement_id" - rlang::check_dots_empty() args <- mget(names(formals())) + + args <- cleanup_arguments( + args = args, + monitoring_location_arguments = list(...), + service = service + ) + return_list <- get_ogc_data(args, output_id, service) return(return_list) diff --git a/R/read_waterdata_field_meta.R b/R/read_waterdata_field_meta.R index b45df015..b499c5fb 100644 --- a/R/read_waterdata_field_meta.R +++ b/R/read_waterdata_field_meta.R @@ -24,6 +24,8 @@ #' Available options are: #' `r dataRetrieval:::get_properties_for_docs("field-measurements-metadata", "field_measurement_id")`. #' The default (`NA`) will return all columns of the data. +#' @param \dots Not used. Included to help differentiate official Water Data API arguments +#' from more seldom used, optional dataRetrieval-specific arguments. #' #' @inheritParams check_arguments_api #' @inheritParams check_arguments_non_api diff --git a/R/read_waterdata_latest_continuous.R b/R/read_waterdata_latest_continuous.R index e450561a..da859f87 100644 --- a/R/read_waterdata_latest_continuous.R +++ b/R/read_waterdata_latest_continuous.R @@ -23,8 +23,13 @@ #' Available options are: #' `r dataRetrieval:::get_properties_for_docs("latest-continuous", "latest_continuous_id")`. #' The default (`NA`) will return all columns of the data. +#' @param \dots Arguments that can be queried, +#' but are not returned. These are used as alternatives to specifying specific +#' monitoring_location_ids. See `make_monitoring_location_arguments()` +#' to get a list of all possible arguments available. #' @inheritParams check_arguments_api #' @inheritParams check_arguments_non_api +#' @seealso [make_monitoring_location_arguments()] #' #' @inherit read_waterdata_continuous details #' @examplesIf is_dataRetrieval_user() @@ -60,6 +65,12 @@ #' parameter_code = c("00060", "72019"), #' last_modified = "P7D") #' +#' dane <- read_waterdata_latest_continuous( +#' state_name = "Wisconsin", +#' county_name = "Dane County", +#' parameter_code = "00060", +#' time = "P1D") +#' #' } read_waterdata_latest_continuous <- function( monitoring_location_id = NA_character_, @@ -83,9 +94,15 @@ read_waterdata_latest_continuous <- function( ) { service <- "latest-continuous" output_id <- "latest_continuous_id" - rlang::check_dots_empty() args <- mget(names(formals())) + + args <- cleanup_arguments( + args = args, + monitoring_location_arguments = list(...), + service = service + ) + return_list <- get_ogc_data(args, output_id, service) return(return_list) diff --git a/R/read_waterdata_latest_daily.R b/R/read_waterdata_latest_daily.R index 85bc6c11..8a329c03 100644 --- a/R/read_waterdata_latest_daily.R +++ b/R/read_waterdata_latest_daily.R @@ -25,9 +25,13 @@ #' Available options are: #' `r dataRetrieval:::get_properties_for_docs("latest-daily", "latest_daily_id")`. #' The default (`NA`) will return all columns of the data. -#' +#' @param \dots Arguments that can be queried, +#' but are not returned. These are used as alternatives to specifying specific +#' monitoring_location_ids. See `make_monitoring_location_arguments()` +#' to get a list of all possible arguments available. #' @inheritParams check_arguments_api #' @inheritParams check_arguments_non_api +#' @seealso [make_monitoring_location_arguments()] #' @inherit read_waterdata_continuous details #' #' @examplesIf is_dataRetrieval_user() @@ -56,6 +60,12 @@ #' "USGS-01645000"), #' parameter_code = c("00060", "00010")) #' +#' dane <- read_waterdata_latest_daily( +#' state_name = "Wisconsin", +#' county_name = "Dane County", +#' parameter_code = "00060", +#' time = "P7D") +#' #' } read_waterdata_latest_daily <- function( monitoring_location_id = NA_character_, @@ -80,9 +90,15 @@ read_waterdata_latest_daily <- function( ) { service <- "latest-daily" output_id <- "latest_daily_id" - rlang::check_dots_empty() args <- mget(names(formals())) + + args <- cleanup_arguments( + args = args, + monitoring_location_arguments = list(...), + service = service + ) + return_list <- get_ogc_data(args, output_id, service) return(return_list) diff --git a/R/read_waterdata_latest_field.R b/R/read_waterdata_latest_field.R index f7a1dcf2..20f86579 100644 --- a/R/read_waterdata_latest_field.R +++ b/R/read_waterdata_latest_field.R @@ -1,4 +1,4 @@ -#' Get latest USGS field measurement data +#' Get Latest USGS Field Measurement Data #' #' @description `r get_description("latest-field-measurements")` #' @@ -25,9 +25,13 @@ #' Available options are: #' `r dataRetrieval:::get_properties_for_docs("latest-field-measurements", "latest_field_id")`. #' The default (`NA`) will return all columns of the data. -#' +#' @param \dots Arguments that can be queried, +#' but are not returned. These are used as alternatives to specifying specific +#' monitoring_location_ids. See `make_monitoring_location_arguments()` +#' to get a list of all possible arguments available. #' @inheritParams check_arguments_api #' @inheritParams check_arguments_non_api +#' @seealso [make_monitoring_location_arguments()] #' @inherit read_waterdata_continuous details #' #' @examplesIf is_dataRetrieval_user() @@ -48,6 +52,11 @@ #' multi_site <- read_waterdata_latest_field_measurements(monitoring_location_id = c("USGS-01435000", #' "USGS-14202650")) #' +#' dane <- read_waterdata_latest_field_measurements( +#' state_name = "Wisconsin", +#' county_name = "Dane County", +#' time = "P30D") +#' #' } read_waterdata_latest_field_measurements <- function( monitoring_location_id = NA_character_, @@ -72,9 +81,15 @@ read_waterdata_latest_field_measurements <- function( ) { service <- "latest-field-measurements" output_id <- "latest_field_id" - rlang::check_dots_empty() args <- mget(names(formals())) + + args <- cleanup_arguments( + args = args, + monitoring_location_arguments = list(...), + service = service + ) + return_list <- get_ogc_data(args, output_id, service) return(return_list) diff --git a/R/read_waterdata_monitoring_location.R b/R/read_waterdata_monitoring_location.R index 8561f98a..898f891c 100644 --- a/R/read_waterdata_monitoring_location.R +++ b/R/read_waterdata_monitoring_location.R @@ -44,10 +44,27 @@ #' @param well_constructed_depth `r get_ogc_params("monitoring-locations")$well_constructed_depth` #' @param hole_constructed_depth `r get_ogc_params("monitoring-locations")$hole_constructed_depth` #' @param depth_source_code `r get_ogc_params("monitoring-locations")$depth_source_code` +#' @param revision_note `r get_ogc_params("monitoring-locations")$revision_note` +#' @param revision_created `r get_ogc_params("monitoring-locations")$revision_created` +#' @param revision_modified `r get_ogc_params("monitoring-locations")$revision_modified` #' @param properties A vector of requested columns to be returned from the query. #' Available options are: #' `r dataRetrieval:::get_properties_for_docs("monitoring-locations", "monitoring_location_id")`. #' The default (`NA`) will return all columns of the data. +#' @param \dots Not used. Included to help differentiate official Water Data API arguments +#' from more seldom used, optional dataRetrieval-specific arguments. +#' @param q Full-text search across the most relevant text fields for this collection +#' (e.g. site name, identifier, number, state, county, and site type). +#' Matching rules: +#' - Case-insensitive, with prefix matching (e.g. poud matches POUDRE). +#' - Words separated by spaces are AND'd together (all must match). +#' - Terms separated by commas are OR'd together (any may match). +#' - Common abbreviations are expanded, so river also matches sites stored as RV (and vice versa). +#' Examples are: +#' q=poudre - sites whose name/identifier starts with or contains poudre +#' q=colorado river - sites matching both colorado and river/rv +#' q=poudre,cache creek - sites matching poudre OR (cache AND creek/ck) +#' #' @inheritParams check_arguments_api #' @inheritParams check_arguments_non_api #' @examplesIf is_dataRetrieval_user() @@ -80,6 +97,7 @@ #' bbox_vals = c(-94.00, 35.0, -93.5, 35.5) #' multi_site <- read_waterdata_monitoring_location(bbox = bbox_vals) #' +#' poudre <- read_waterdata_monitoring_location(q = "poudre") #' #' } read_waterdata_monitoring_location <- function( @@ -123,7 +141,11 @@ read_waterdata_monitoring_location <- function( well_constructed_depth = NA_character_, hole_constructed_depth = NA_character_, depth_source_code = NA_character_, + revision_note = NA_character_, + revision_created = NA_character_, + revision_modified = NA_character_, properties = NA_character_, + q = NA_character_, bbox = NA, skipGeometry = NA, ..., diff --git a/R/read_waterdata_peaks.R b/R/read_waterdata_peaks.R index 3fb61447..871d7f50 100644 --- a/R/read_waterdata_peaks.R +++ b/R/read_waterdata_peaks.R @@ -36,8 +36,13 @@ #' or whether to set those dates to `NA` (`FALSE`). Peaks with uncertain days #' are stored on the first of the month, and those with uncertain #' month stored on January 1. Default is `FALSE`. +#' @param \dots Arguments that can be queried, +#' but are not returned. These are used as alternatives to specifying specific +#' monitoring_location_ids. See `make_monitoring_location_arguments()` +#' to get a list of all possible arguments available. #' @inheritParams check_arguments_api #' @inheritParams check_arguments_non_api +#' @seealso [make_monitoring_location_arguments()] #' #' @inherit read_waterdata_continuous details #' @@ -54,6 +59,11 @@ #' monitoring_location_id = wi_peaks$monitoring_location_id[1], #' parameter_code = "00060") #' +#' dane <- read_waterdata_peaks( +#' state_name = "Wisconsin", +#' county_name = "Dane County", +#' parameter_code = "00060") +#' #' incomplete_dates_not_allowed <- read_waterdata_peaks( #' monitoring_location_id = "USGS-06334330", #' parameter_code = "00060") @@ -93,9 +103,15 @@ read_waterdata_peaks <- function( ) { service <- "peaks" output_id <- "peak_id" - rlang::check_dots_empty() args <- mget(names(formals())) + + args <- cleanup_arguments( + args = args, + monitoring_location_arguments = list(...), + service = service + ) + args[["allow_incomplete_dates"]] <- NULL return_list <- get_ogc_data(args, output_id, service) diff --git a/R/read_waterdata_ts_meta.R b/R/read_waterdata_ts_meta.R index b3f869de..0b06a704 100644 --- a/R/read_waterdata_ts_meta.R +++ b/R/read_waterdata_ts_meta.R @@ -45,6 +45,8 @@ #' `r dataRetrieval:::get_properties_for_docs("time-series-metadata", "time_series_id")`. #' The default (`NA`) will return all columns of the data. #' @param time_series_id `r get_ogc_params("time-series-metadata")$id` +#' @param \dots Not used. Included to help differentiate official Water Data API arguments +#' from more seldom used, optional dataRetrieval-specific arguments. #' @inheritParams check_arguments_api #' @inheritParams check_arguments_non_api #' diff --git a/_pkgdown.yml b/_pkgdown.yml index dacf3d73..86ee1aad 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -65,6 +65,10 @@ navbar: - text: How to Contribute href: articles/Contributing.html right: + - text: News + href: news/index.html + - icon: fa-gitlab fa-lg + href: https://code.usgs.gov/water/dataRetrieval - icon: fa-github fa-lg href: https://github.com/DOI-USGS/dataRetrieval reference: @@ -79,7 +83,7 @@ reference: - read_waterdata_monitoring_location - read_waterdata_latest_continuous - read_waterdata_latest_daily - - read_waterdata_latest_field + - read_waterdata_latest_field_measurements - read_waterdata_field_measurements - read_waterdata_parameter_codes - read_waterdata_metadata @@ -91,6 +95,7 @@ reference: - read_waterdata_peaks - summarize_waterdata_samples - check_waterdata_sample_params + - make_monitoring_location_arguments - title: National Water Information System (NWIS) desc: Functions to retrieve (USGS) NWIS data. These will be slowly phased out and replaced with the read_waterdata family of functions. contents: diff --git a/man/check_arguments_non_api.Rd b/man/check_arguments_non_api.Rd index 193ab821..bf59ebb9 100644 --- a/man/check_arguments_non_api.Rd +++ b/man/check_arguments_non_api.Rd @@ -9,8 +9,7 @@ check_arguments_non_api( no_paging, limit, attach_request, - chunk_size, - ... + chunk_size ) } \arguments{ @@ -40,9 +39,6 @@ is 250, while the default for time series functions is 10. Setting to \code{NA} will eliminate site chunking, giving users full control.} - -\item{\dots}{Not used. Included to help differentiate official Water Data API arguments -from more seldom used, optional dataRetrieval-specific arguments.} } \description{ Function to check types and create parameter descriptions. diff --git a/man/make_monitoring_location_arguments.Rd b/man/make_monitoring_location_arguments.Rd new file mode 100644 index 00000000..802efdda --- /dev/null +++ b/man/make_monitoring_location_arguments.Rd @@ -0,0 +1,158 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/make_monitoring_location_arguments.R +\name{make_monitoring_location_arguments} +\alias{make_monitoring_location_arguments} +\title{Get Monitoring Location Arguments} +\usage{ +make_monitoring_location_arguments( + service = "daily", + agency_code = NA_character_, + agency_name = NA_character_, + monitoring_location_number = NA_character_, + monitoring_location_name = NA_character_, + district_code = NA_character_, + country_code = NA_character_, + country_name = NA_character_, + state_code = NA_character_, + state_name = NA_character_, + county_code = NA_character_, + county_name = NA_character_, + minor_civil_division_code = NA_character_, + site_type_code = NA_character_, + site_type = NA_character_, + hydrologic_unit_code = NA_character_, + basin_code = NA_character_, + altitude = NA_character_, + altitude_accuracy = NA_character_, + altitude_method_code = NA_character_, + altitude_method_name = NA_character_, + vertical_datum = NA_character_, + vertical_datum_name = NA_character_, + horizontal_positional_accuracy_code = NA_character_, + horizontal_positional_accuracy = NA_character_, + horizontal_position_method_code = NA_character_, + horizontal_position_method_name = NA_character_, + original_horizontal_datum = NA_character_, + original_horizontal_datum_name = NA_character_, + drainage_area = NA_character_, + contributing_drainage_area = NA_character_, + time_zone_abbreviation = NA_character_, + uses_daylight_savings = NA_character_, + construction_date = NA_character_, + aquifer_code = NA_character_, + national_aquifer_code = NA_character_, + aquifer_type_code = NA_character_, + well_constructed_depth = NA_character_, + hole_constructed_depth = NA_character_, + depth_source_code = NA_character_, + data_gap_interval = NA_character_, + ..., + check_arguments = FALSE +) +} +\arguments{ +\item{service}{Endpoint to check arguments against. Possible values are +"daily", "latest-continuous", "field-measurements", "latest-daily", +"latest-field-measurements", "continuous", "peaks".} + +\item{agency_code}{The agency that is reporting the data. Agency codes are fixed values assigned by the National Water Information System (NWIS). A list of agency codes is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/agency-codes/items}.} + +\item{agency_name}{The name of the agency that is reporting the data.} + +\item{monitoring_location_number}{Each monitoring location in the USGS data base has a unique 8- to 15-digit identification number.} + +\item{monitoring_location_name}{This is the official name of the monitoring location in the database. For well information this can be a district-assigned local number.} + +\item{district_code}{The Water Science Centers (WSCs) across the United States use the FIPS state code as the district code. In some case, monitoring locations and samples may be managed by a water science center that is adjacent to the state in which the monitoring location actually resides. For example a monitoring location may have a district code of 30 which translates to Montana, but the state code could be 56 for Wyoming because that is where the monitoring location actually is located.} + +\item{country_code}{The code for the country in which the monitoring location is located.} + +\item{country_name}{The name of the country in which the monitoring location is located.} + +\item{state_code}{State code. A \href{https://www2.census.gov/geo/docs/reference/state.txt}{two-digit ANSI code} (formerly FIPS code) as defined by the American National Standards Institute, to define States and equivalents. A three-digit ANSI code is used to define counties and county equivalents. \href{https://www.census.gov/library/reference/code-lists/ansi.html#states}{A lookup table is available.} The only countries with political subdivisions other than the US are Mexico and Canada. The Mexican states have US state codes ranging from 81-86 and Canadian provinces have state codes ranging from 90-98.} + +\item{state_name}{The name of the state or state equivalent in which the monitoring location is located.} + +\item{county_code}{The code for the county or county equivalent (parish, borough, etc.) in which the monitoring location is located. A list of codes is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/counties/items}.} + +\item{county_name}{The name of the county or county equivalent (parish, borough, etc.) in which the monitoring location is located. [A list of codes is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/counties/items}.} + +\item{minor_civil_division_code}{Codes for primary governmental or administrative divisions of the county or county equivalent in which the monitoring location is located.} + +\item{site_type_code}{A code describing the hydrologic setting of the monitoring location. A list of codes is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/site-types/items}.} + +\item{site_type}{A description of the hydrologic setting of the monitoring location. A list of codes is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/site-types/items}.} + +\item{hydrologic_unit_code}{The hydrologic unit code (HUC) for the monitoring location. Supports prefix matching — querying with a shorter HUC (e.g. "04") matches all locations within that hydrologic region.} + +\item{basin_code}{The Basin Code or "drainage basin code" is a two-digit code that further subdivides the 8-digit hydrologic-unit code. The drainage basin code is defined by the USGS State Office where the monitoring location is located.} + +\item{altitude}{Altitude of the monitoring location referenced to the specified Vertical Datum.} + +\item{altitude_accuracy}{Accuracy of the altitude, in feet. An accuracy of +/- 0.1 foot would be entered as “.1”. Many altitudes are interpolated from the contours on topographic maps; accuracies determined in this way are generally entered as one-half of the contour interval.} + +\item{altitude_method_code}{Codes representing the method used to measure altitude.} + +\item{altitude_method_name}{The name of the method used to measure altitude.} + +\item{vertical_datum}{The datum used to determine altitude and vertical position at the monitoring location. A list of codes is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/altitude-datums/items}.} + +\item{vertical_datum_name}{The datum used to determine altitude and vertical position at the monitoring location. A list of codes is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/altitude-datums/items}.} + +\item{horizontal_positional_accuracy_code}{Indicates the accuracy of the latitude longitude values. A list of codes is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/coordinate-accuracy-codes/items}.} + +\item{horizontal_positional_accuracy}{The agency that is reporting the data. Agency codes are fixed values assigned by the National Water Information System (NWIS). A list of agency codes is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/agency-codes/items}.} + +\item{horizontal_position_method_code}{Indicates the method used to determine latitude longitude values. A list of codes is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/coordinate-method-codes/items}.} + +\item{horizontal_position_method_name}{Indicates the method used to determine latitude longitude values. A list of codes is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/coordinate-method-codes/items}.} + +\item{original_horizontal_datum}{Coordinates are published in EPSG:4326 / WGS84 / World Geodetic System 1984. This field indicates the original datum used to determine coordinates before they were converted. A list of codes is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/coordinate-datum-codes/items}.} + +\item{original_horizontal_datum_name}{Coordinates are published in EPSG:4326 / WGS84 / World Geodetic System 1984. This field indicates the original datum used to determine coordinates before they were converted. A list of codes is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/coordinate-datum-codes/items}.} + +\item{drainage_area}{The area enclosed by a topographic divide from which direct surface runoff from precipitation normally drains by gravity into the stream above that point.} + +\item{contributing_drainage_area}{The contributing drainage area of a lake, stream, wetland, or estuary monitoring location, in square miles. This item should be present only if the contributing area is different from the total drainage area. This situation can occur when part of the drainage area consists of very porous soil or depressions that either allow all runoff to enter the groundwater or traps the water in ponds so that rainfall does not contribute to runoff. A transbasin diversion can also affect the total drainage area.} + +\item{time_zone_abbreviation}{A short code describing the time zone used by a monitoring location.} + +\item{uses_daylight_savings}{The agency that is reporting the data. Agency codes are fixed values assigned by the National Water Information System (NWIS). A list of agency codes is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/agency-codes/items}.} + +\item{construction_date}{Date the well was completed.} + +\item{aquifer_code}{Local aquifers in the USGS water resources data base are identified by a geohydrologic unit code (a three-digit number related to the age of the formation, followed by a 4 or 5 character abbreviation for the geologic unit or aquifer name).} + +\item{national_aquifer_code}{National aquifers are the principal aquifers or aquifer systems in the United States, defined as regionally extensive aquifers or aquifer systems that have the potential to be used as a source of potable water. Not all groundwater monitoring locations can be associated with a National Aquifer. Such monitoring locations will not be retrieved using this search criteria. A list of National aquifer codes and names is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/national-aquifer-codes/items}.} + +\item{aquifer_type_code}{The agency that is reporting the data. Agency codes are fixed values assigned by the National Water Information System (NWIS). A list of agency codes is available at \url{https://api.waterdata.usgs.gov/ogcapi/v0/collections/agency-codes/items}.} + +\item{well_constructed_depth}{The depth of the finished well, in feet below land surface datum. Note: Not all groundwater monitoring locations have information on Well Depth. Such monitoring locations will not be retrieved using this search criteria.} + +\item{hole_constructed_depth}{The total depth to which the hole is drilled, in feet below land surface datum. Note: Not all groundwater monitoring locations have information on Hole Depth. Such monitoring locations will not be retrieved using this search criteria.} + +\item{depth_source_code}{A code indicating the source of water-level data.} + +\item{data_gap_interval}{The time interval threshold used for gap detection in the time series.} + +\item{\dots}{Not used. Used to make sure the user isn't passing in arguments that aren't available.} + +\item{check_arguments}{Logical. Used to decide if the arguments passed in are available or not. The +default is \code{FALSE}. Using \code{TRUE} will make two calls to the API, so if you are concerned +with minimizing API calls, keep this value as \code{FALSE}. If you are concerned with +making sure your calls are accepted by the service, set to \code{TRUE}.} +} +\description{ +Many read_waterdata functions have a long list of arguments that can be used +to find sites that have data. Users can use this function to create a list +of possible arguments that can be used as input to the \code{monitoring_location_arguments} +argument (found in many of the read_waterdata functions). This function +also is used to check that user supplied available parameters to their queries +when using the \code{monitoring_location_arguments} argument. +} +\examples{ + +make_monitoring_location_arguments(service = "daily", agency_name = "USGS") +make_monitoring_location_arguments(service = "field-measurements", + state_name = c("Ohio", "Wisconsin")) +} diff --git a/man/read_ngwmn_lithology.Rd b/man/read_ngwmn_lithology.Rd index b50588ba..27b9636f 100644 --- a/man/read_ngwmn_lithology.Rd +++ b/man/read_ngwmn_lithology.Rd @@ -26,7 +26,7 @@ Available options are: agency_code, monitoring_location_number, monitoring_location_id, monitoring_location_obs_number, lithology_id, lithology_description, lithology_controlled_concept, lithology_depth_from, lithology_depth_to, lithology_depth_to_unit, lithology_depth_from_unit. The default (\code{NA}) will return all columns of the data.} -\item{...}{Not used. Included to help differentiate official Water Data API arguments +\item{\dots}{Not used. Included to help differentiate official NGWMN API arguments from more seldom used, optional dataRetrieval-specific arguments.} \item{convertType}{logical, defaults to TRUE. diff --git a/man/read_ngwmn_providers.Rd b/man/read_ngwmn_providers.Rd index 82bd71d7..6d128f88 100644 --- a/man/read_ngwmn_providers.Rd +++ b/man/read_ngwmn_providers.Rd @@ -29,7 +29,7 @@ Available options are: agency_name, agency_code, organization_type, state, link. The default (\code{NA}) will return all columns of the data.} -\item{...}{Not used. Included to help differentiate official Water Data API arguments +\item{\dots}{Not used. Included to help differentiate official NGWMN API arguments from more seldom used, optional dataRetrieval-specific arguments.} \item{convertType}{logical, defaults to TRUE. diff --git a/man/read_ngwmn_sites.Rd b/man/read_ngwmn_sites.Rd index f291585e..35868f69 100644 --- a/man/read_ngwmn_sites.Rd +++ b/man/read_ngwmn_sites.Rd @@ -108,7 +108,7 @@ The default (\code{NA}) will return all columns of the data.} each feature. The returning object will be a data frame with no spatial information.} -\item{...}{Not used. Included to help differentiate official Water Data API arguments +\item{\dots}{Not used. Included to help differentiate official NGWMN API arguments from more seldom used, optional dataRetrieval-specific arguments.} \item{convertType}{logical, defaults to TRUE. diff --git a/man/read_ngwmn_water_level.Rd b/man/read_ngwmn_water_level.Rd index 949c0751..f0b95fe4 100644 --- a/man/read_ngwmn_water_level.Rd +++ b/man/read_ngwmn_water_level.Rd @@ -65,7 +65,7 @@ Examples: Only features that have a \code{sample_time} that intersects the value of datetime are selected. If a feature has multiple temporal properties, it is the decision of the server whether only a single temporal property is used to determine the extent or all relevant temporal properties.} -\item{...}{Not used. Included to help differentiate official Water Data API arguments +\item{\dots}{Not used. Included to help differentiate official NGWMN API arguments from more seldom used, optional dataRetrieval-specific arguments.} \item{convertType}{logical, defaults to TRUE. diff --git a/man/read_ngwmn_well_construction.Rd b/man/read_ngwmn_well_construction.Rd index 352e166e..907f21c8 100644 --- a/man/read_ngwmn_well_construction.Rd +++ b/man/read_ngwmn_well_construction.Rd @@ -29,7 +29,7 @@ Available options are: agency_code, monitoring_location_number, monitoring_location_id, monitoring_location_obs_number, type, depth_from, depth_to, depth_from_unit, depth_to_unit, material, diameter, diameter_unit, hole_size, hole_size_unit. The default (\code{NA}) will return all columns of the data.} -\item{...}{Not used. Included to help differentiate official Water Data API arguments +\item{\dots}{Not used. Included to help differentiate official NGWMN API arguments from more seldom used, optional dataRetrieval-specific arguments.} \item{convertType}{logical, defaults to TRUE. diff --git a/man/read_waterdata_channel.Rd b/man/read_waterdata_channel.Rd index e9bee3b9..9f7e0c0e 100644 --- a/man/read_waterdata_channel.Rd +++ b/man/read_waterdata_channel.Rd @@ -132,7 +132,7 @@ vector structured: c(xmin,ymin,xmax,ymax). Another way to think of it is c(Western-most longitude, Southern-most latitude, Eastern-most longitude, Northern-most longitude).} -\item{...}{Not used. Included to help differentiate official Water Data API arguments +\item{\dots}{Not used. Included to help differentiate official Water Data API arguments from more seldom used, optional dataRetrieval-specific arguments.} \item{convertType}{logical, defaults to TRUE. diff --git a/man/read_waterdata_combined_meta.Rd b/man/read_waterdata_combined_meta.Rd index f5147793..8f3f0100 100644 --- a/man/read_waterdata_combined_meta.Rd +++ b/man/read_waterdata_combined_meta.Rd @@ -252,7 +252,7 @@ vector structured: c(xmin,ymin,xmax,ymax). Another way to think of it is c(Western-most longitude, Southern-most latitude, Eastern-most longitude, Northern-most longitude).} -\item{...}{Not used. Included to help differentiate official Water Data API arguments +\item{\dots}{Not used. Included to help differentiate official Water Data API arguments from more seldom used, optional dataRetrieval-specific arguments.} \item{convertType}{logical, defaults to TRUE. diff --git a/man/read_waterdata_continuous.Rd b/man/read_waterdata_continuous.Rd index cb48d15b..55f87fd9 100644 --- a/man/read_waterdata_continuous.Rd +++ b/man/read_waterdata_continuous.Rd @@ -90,8 +90,10 @@ vector structured: c(xmin,ymin,xmax,ymax). Another way to think of it is c(Western-most longitude, Southern-most latitude, Eastern-most longitude, Northern-most longitude).} -\item{\dots}{Not used. Included to help differentiate official Water Data API arguments -from more seldom used, optional dataRetrieval-specific arguments.} +\item{\dots}{Arguments that can be queried, +but are not returned. These are used as alternatives to specifying specific +monitoring_location_ids. See \code{make_monitoring_location_arguments()} +to get a list of all possible arguments available.} \item{convertType}{logical, defaults to TRUE. If \code{TRUE}, the function will convert the data to dates, any qualifiers to string @@ -127,7 +129,7 @@ Currently, the services only allow up to 3 years of data to be requested with a single request. If no "time" is specified, the service will return the last single year of data. If this is a bottleneck, please check back for new direct download functions that are expected to be available sometime -in 2026. +in 2027. } \details{ You can also use a vector of length 2 for any time queries (such as time @@ -170,6 +172,12 @@ multi_site2 <- read_waterdata_continuous(monitoring_location_id = c("USGS-45160 parameter_code = c("00060", "72019"), last_modified = "P7D") +dane <- read_waterdata_continuous( + state_name = "Wisconsin", + county_name = "Dane County", + parameter_code = "00060", + time = "P1D") + # how to split up request into roughly 3 year chunks site <- "USGS-0208458892" @@ -205,3 +213,6 @@ time_df <- data.frame(start = time_chunks[-length(time_chunks)], } \dontshow{\}) # examplesIf} } +\seealso{ +\code{\link[=make_monitoring_location_arguments]{make_monitoring_location_arguments()}} +} diff --git a/man/read_waterdata_daily.Rd b/man/read_waterdata_daily.Rd index 9c0efdd0..6f35753b 100644 --- a/man/read_waterdata_daily.Rd +++ b/man/read_waterdata_daily.Rd @@ -95,8 +95,10 @@ vector structured: c(xmin,ymin,xmax,ymax). Another way to think of it is c(Western-most longitude, Southern-most latitude, Eastern-most longitude, Northern-most longitude).} -\item{...}{Not used. Included to help differentiate official Water Data API arguments -from more seldom used, optional dataRetrieval-specific arguments.} +\item{\dots}{Arguments that can be queried, +but are not returned. These are used as alternatives to specifying specific +monitoring_location_ids. See \code{make_monitoring_location_arguments()} +to get a list of all possible arguments available.} \item{convertType}{logical, defaults to TRUE. If \code{TRUE}, the function will convert the data to dates, any qualifiers to string @@ -187,6 +189,16 @@ options("dataRetrieval.attach_request" = FALSE) dv_data_no_request <- read_waterdata_daily(monitoring_location_id = site, parameter_code = "00060", time = c("2021-01-01", "2022-01-01")) + +dv_dane <- read_waterdata_daily( + state_name = "Wisconsin", + county_name = "Dane County", + parameter_code = "00060", + time = "P7D") + } \dontshow{\}) # examplesIf} } +\seealso{ +\code{\link[=make_monitoring_location_arguments]{make_monitoring_location_arguments()}} +} diff --git a/man/read_waterdata_field_measurements.Rd b/man/read_waterdata_field_measurements.Rd index 95271b34..4adee87c 100644 --- a/man/read_waterdata_field_measurements.Rd +++ b/man/read_waterdata_field_measurements.Rd @@ -118,8 +118,10 @@ vector structured: c(xmin,ymin,xmax,ymax). Another way to think of it is c(Western-most longitude, Southern-most latitude, Eastern-most longitude, Northern-most longitude).} -\item{...}{Not used. Included to help differentiate official Water Data API arguments -from more seldom used, optional dataRetrieval-specific arguments.} +\item{\dots}{Arguments that can be queried, +but are not returned. These are used as alternatives to specifying specific +monitoring_location_ids. See \code{make_monitoring_location_arguments()} +to get a list of all possible arguments available.} \item{convertType}{logical, defaults to TRUE. If \code{TRUE}, the function will convert the data to dates, any qualifiers to string @@ -206,7 +208,16 @@ surface_water <- read_waterdata_field_measurements( time = "2024-07-01T00:00:00Z/..", parameter_code = "00060") +dane <- read_waterdata_field_measurements( + state_name = "Wisconsin", + county_name = "Dane County", + parameter_code = "00060", + time = "P30D") + } \dontshow{\}) # examplesIf} } +\seealso{ +\code{\link[=make_monitoring_location_arguments]{make_monitoring_location_arguments()}} +} diff --git a/man/read_waterdata_field_meta.Rd b/man/read_waterdata_field_meta.Rd index 30bec39a..9047ae65 100644 --- a/man/read_waterdata_field_meta.Rd +++ b/man/read_waterdata_field_meta.Rd @@ -104,7 +104,7 @@ limit is 50,000. It may be beneficial to set this number lower if your internet connection is spotty. The default (\code{NA}) will set the limit to the maximum allowable limit for the service.} -\item{...}{Not used. Included to help differentiate official Water Data API arguments +\item{\dots}{Not used. Included to help differentiate official Water Data API arguments from more seldom used, optional dataRetrieval-specific arguments.} \item{convertType}{logical, defaults to TRUE. diff --git a/man/read_waterdata_latest_continuous.Rd b/man/read_waterdata_latest_continuous.Rd index 5af72c3f..ea1da5b8 100644 --- a/man/read_waterdata_latest_continuous.Rd +++ b/man/read_waterdata_latest_continuous.Rd @@ -90,8 +90,10 @@ vector structured: c(xmin,ymin,xmax,ymax). Another way to think of it is c(Western-most longitude, Southern-most latitude, Eastern-most longitude, Northern-most longitude).} -\item{...}{Not used. Included to help differentiate official Water Data API arguments -from more seldom used, optional dataRetrieval-specific arguments.} +\item{\dots}{Arguments that can be queried, +but are not returned. These are used as alternatives to specifying specific +monitoring_location_ids. See \code{make_monitoring_location_arguments()} +to get a list of all possible arguments available.} \item{convertType}{logical, defaults to TRUE. If \code{TRUE}, the function will convert the data to dates, any qualifiers to string @@ -173,6 +175,15 @@ multi_site2 <- read_waterdata_latest_continuous(monitoring_location_id = c("USG parameter_code = c("00060", "72019"), last_modified = "P7D") +dane <- read_waterdata_latest_continuous( + state_name = "Wisconsin", + county_name = "Dane County", + parameter_code = "00060", + time = "P1D") + } \dontshow{\}) # examplesIf} } +\seealso{ +\code{\link[=make_monitoring_location_arguments]{make_monitoring_location_arguments()}} +} diff --git a/man/read_waterdata_latest_daily.Rd b/man/read_waterdata_latest_daily.Rd index 3989eb39..bdf08ab6 100644 --- a/man/read_waterdata_latest_daily.Rd +++ b/man/read_waterdata_latest_daily.Rd @@ -95,8 +95,10 @@ vector structured: c(xmin,ymin,xmax,ymax). Another way to think of it is c(Western-most longitude, Southern-most latitude, Eastern-most longitude, Northern-most longitude).} -\item{...}{Not used. Included to help differentiate official Water Data API arguments -from more seldom used, optional dataRetrieval-specific arguments.} +\item{\dots}{Arguments that can be queried, +but are not returned. These are used as alternatives to specifying specific +monitoring_location_ids. See \code{make_monitoring_location_arguments()} +to get a list of all possible arguments available.} \item{convertType}{logical, defaults to TRUE. If \code{TRUE}, the function will convert the data to dates, any qualifiers to string @@ -171,6 +173,15 @@ multi_site <- read_waterdata_latest_daily(monitoring_location_id = c("USGS-0149 "USGS-01645000"), parameter_code = c("00060", "00010")) +dane <- read_waterdata_latest_daily( + state_name = "Wisconsin", + county_name = "Dane County", + parameter_code = "00060", + time = "P7D") + } \dontshow{\}) # examplesIf} } +\seealso{ +\code{\link[=make_monitoring_location_arguments]{make_monitoring_location_arguments()}} +} diff --git a/man/read_waterdata_latest_field_measurements.Rd b/man/read_waterdata_latest_field_measurements.Rd index 3303acfe..33f723e6 100644 --- a/man/read_waterdata_latest_field_measurements.Rd +++ b/man/read_waterdata_latest_field_measurements.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/read_waterdata_latest_field.R \name{read_waterdata_latest_field_measurements} \alias{read_waterdata_latest_field_measurements} -\title{Get latest USGS field measurement data} +\title{Get Latest USGS Field Measurement Data} \usage{ read_waterdata_latest_field_measurements( monitoring_location_id = NA_character_, @@ -91,8 +91,10 @@ vector structured: c(xmin,ymin,xmax,ymax). Another way to think of it is c(Western-most longitude, Southern-most latitude, Eastern-most longitude, Northern-most longitude).} -\item{...}{Not used. Included to help differentiate official Water Data API arguments -from more seldom used, optional dataRetrieval-specific arguments.} +\item{\dots}{Arguments that can be queried, +but are not returned. These are used as alternatives to specifying specific +monitoring_location_ids. See \code{make_monitoring_location_arguments()} +to get a list of all possible arguments available.} \item{convertType}{logical, defaults to TRUE. If \code{TRUE}, the function will convert the data to dates, any qualifiers to string @@ -159,6 +161,14 @@ field_data <- read_waterdata_latest_field_measurements(monitoring_location_id = multi_site <- read_waterdata_latest_field_measurements(monitoring_location_id = c("USGS-01435000", "USGS-14202650")) +dane <- read_waterdata_latest_field_measurements( + state_name = "Wisconsin", + county_name = "Dane County", + time = "P30D") + } \dontshow{\}) # examplesIf} } +\seealso{ +\code{\link[=make_monitoring_location_arguments]{make_monitoring_location_arguments()}} +} diff --git a/man/read_waterdata_monitoring_location.Rd b/man/read_waterdata_monitoring_location.Rd index be42815c..ee2b32f7 100644 --- a/man/read_waterdata_monitoring_location.Rd +++ b/man/read_waterdata_monitoring_location.Rd @@ -45,7 +45,11 @@ read_waterdata_monitoring_location( well_constructed_depth = NA_character_, hole_constructed_depth = NA_character_, depth_source_code = NA_character_, + revision_note = NA_character_, + revision_created = NA_character_, + revision_modified = NA_character_, properties = NA_character_, + q = NA_character_, bbox = NA, skipGeometry = NA, ..., @@ -138,11 +142,31 @@ Multiple monitoring_location_ids can be requested as a character vector.} \item{depth_source_code}{A code indicating the source of water-level data.} +\item{revision_note}{Approved water data are considered published record, but on occasion changes or deletions (revisions) must be made to data after they are approved. Data revisions are rare because of USGS quality assurance practices, including documentation of all data before they are officially approved. This field contains text explanations for data revisions at this monitoring location. Changes to data also are indicated with revision qualifier codes alongside the data. Text explanations before 2017 are not necessarily available online, but can be requested.} + +\item{revision_created}{The date a revision statement was created.} + +\item{revision_modified}{The most recent date a revision statement was modified.} + \item{properties}{A vector of requested columns to be returned from the query. Available options are: geometry, monitoring_location_id, agency_code, agency_name, monitoring_location_number, monitoring_location_name, district_code, country_code, country_name, state_code, state_name, county_code, county_name, minor_civil_division_code, site_type_code, site_type, hydrologic_unit_code, basin_code, altitude, altitude_accuracy, altitude_method_code, altitude_method_name, vertical_datum, vertical_datum_name, horizontal_positional_accuracy_code, horizontal_positional_accuracy, horizontal_position_method_code, horizontal_position_method_name, original_horizontal_datum, original_horizontal_datum_name, drainage_area, contributing_drainage_area, time_zone_abbreviation, uses_daylight_savings, construction_date, aquifer_code, national_aquifer_code, aquifer_type_code, well_constructed_depth, hole_constructed_depth, depth_source_code, revision_note, revision_created, revision_modified. The default (\code{NA}) will return all columns of the data.} +\item{q}{Full-text search across the most relevant text fields for this collection +(e.g. site name, identifier, number, state, county, and site type). +Matching rules: +\itemize{ +\item Case-insensitive, with prefix matching (e.g. poud matches POUDRE). +\item Words separated by spaces are AND'd together (all must match). +\item Terms separated by commas are OR'd together (any may match). +\item Common abbreviations are expanded, so river also matches sites stored as RV (and vice versa). +Examples are: +q=poudre - sites whose name/identifier starts with or contains poudre +q=colorado river - sites matching both colorado and river/rv +q=poudre,cache creek - sites matching poudre OR (cache AND creek/ck) +}} + \item{bbox}{Only features that have a geometry that intersects the bounding box are selected.The bounding box is provided as four or six numbers, depending on whether the coordinate reference system includes a vertical axis (height or @@ -155,7 +179,7 @@ Southern-most latitude, Eastern-most longitude, Northern-most longitude).} each feature. The returning object will be a data frame with no spatial information. The default \code{NA} will not specify the argument in the request.} -\item{...}{Not used. Included to help differentiate official Water Data API arguments +\item{\dots}{Not used. Included to help differentiate official Water Data API arguments from more seldom used, optional dataRetrieval-specific arguments.} \item{limit}{numeric, The optional limit parameter is used to control the subset of the @@ -215,6 +239,7 @@ site_info_no_sf <- read_waterdata_monitoring_location( bbox_vals = c(-94.00, 35.0, -93.5, 35.5) multi_site <- read_waterdata_monitoring_location(bbox = bbox_vals) +poudre <- read_waterdata_monitoring_location(q = "poudre") } \dontshow{\}) # examplesIf} diff --git a/man/read_waterdata_peaks.Rd b/man/read_waterdata_peaks.Rd index 260b3654..4a758af8 100644 --- a/man/read_waterdata_peaks.Rd +++ b/man/read_waterdata_peaks.Rd @@ -104,8 +104,10 @@ vector structured: c(xmin,ymin,xmax,ymax). Another way to think of it is c(Western-most longitude, Southern-most latitude, Eastern-most longitude, Northern-most longitude).} -\item{...}{Not used. Included to help differentiate official Water Data API arguments -from more seldom used, optional dataRetrieval-specific arguments.} +\item{\dots}{Arguments that can be queried, +but are not returned. These are used as alternatives to specifying specific +monitoring_location_ids. See \code{make_monitoring_location_arguments()} +to get a list of all possible arguments available.} \item{allow_incomplete_dates}{Specifically in the peaks data, exact peak dates are not always known. Sometimes peaks are known just for the year, sometimes @@ -176,6 +178,11 @@ dv_data_sf <- read_waterdata_peaks( monitoring_location_id = wi_peaks$monitoring_location_id[1], parameter_code = "00060") +dane <- read_waterdata_peaks( + state_name = "Wisconsin", + county_name = "Dane County", + parameter_code = "00060") + incomplete_dates_not_allowed <- read_waterdata_peaks( monitoring_location_id = "USGS-06334330", parameter_code = "00060") @@ -189,3 +196,6 @@ incomplete_dates_allowed$time } \dontshow{\}) # examplesIf} } +\seealso{ +\code{\link[=make_monitoring_location_arguments]{make_monitoring_location_arguments()}} +} diff --git a/man/read_waterdata_ts_meta.Rd b/man/read_waterdata_ts_meta.Rd index dd4c80cb..fd381a2f 100644 --- a/man/read_waterdata_ts_meta.Rd +++ b/man/read_waterdata_ts_meta.Rd @@ -145,7 +145,7 @@ Southern-most latitude, Eastern-most longitude, Northern-most longitude).} \item{end}{This field contains the same information as "end_utc", but in the local time of the monitoring location. It is retained for backwards compatibility, but will be removed in V1 of these APIs.} -\item{...}{Not used. Included to help differentiate official Water Data API arguments +\item{\dots}{Not used. Included to help differentiate official Water Data API arguments from more seldom used, optional dataRetrieval-specific arguments.} \item{limit}{numeric, The optional limit parameter is used to control the subset of the diff --git a/tests/testthat/tests_userFriendly_fxns.R b/tests/testthat/tests_userFriendly_fxns.R index b59e8fbd..23215ed9 100644 --- a/tests/testthat/tests_userFriendly_fxns.R +++ b/tests/testthat/tests_userFriendly_fxns.R @@ -272,45 +272,44 @@ test_that("read_waterdata_daily", { # "ICE, REGULATED, UNKNOWNREGULATION")) }) -test_that("WQP qw tests", { - testthat::skip_on_cran() - skip_on_ci() - # nameToUse <- "Specific conductance" - # pcodeToUse <- "00095" - # - # INFO_WQP <- readWQPqw( - # "USGS-04024315", - # pcodeToUse, - # startDate = "", - # endDate = "", - # legacy = FALSE - # ) - # expect_is(INFO_WQP$Activity_StartDateTime, "POSIXct") - # - # INFO2 <- readWQPqw( - # "WIDNR_WQX-10032762", - # nameToUse, - # startDate = "", - # endDate = "", - # legacy = FALSE - # ) - # expect_is(INFO2$Activity_StartDateTime, "POSIXct") - # - # df <- readWQPqw("USGS-04193500", parameterCd = "00665", legacy = FALSE) - # expect_true(nrow(df) > 0) - # - # df2 <- readWQPqw("USGS-05427718", parameterCd = "all") - # expect_true(nrow(df2) > 0) - # - # #Empty legacy: - # df3 <- readWQPqw( - # siteNumbers = "USGS-385032115220501", - # parameterCd = "all", - # legacy = TRUE - # ) - # expect_true(nrow(df3) == 0) -}) - +# test_that("WQP qw tests", { +# testthat::skip_on_cran() +# skip_on_ci() +# nameToUse <- "Specific conductance" +# pcodeToUse <- "00095" +# +# INFO_WQP <- readWQPqw( +# "USGS-04024315", +# pcodeToUse, +# startDate = "", +# endDate = "", +# legacy = FALSE +# ) +# expect_is(INFO_WQP$Activity_StartDateTime, "POSIXct") +# +# INFO2 <- readWQPqw( +# "WIDNR_WQX-10032762", +# nameToUse, +# startDate = "", +# endDate = "", +# legacy = FALSE +# ) +# expect_is(INFO2$Activity_StartDateTime, "POSIXct") +# +# df <- readWQPqw("USGS-04193500", parameterCd = "00665", legacy = FALSE) +# expect_true(nrow(df) > 0) +# +# df2 <- readWQPqw("USGS-05427718", parameterCd = "all") +# expect_true(nrow(df2) > 0) +# +# #Empty legacy: +# df3 <- readWQPqw( +# siteNumbers = "USGS-385032115220501", +# parameterCd = "all", +# legacy = TRUE +# ) +# expect_true(nrow(df3) == 0) +# }) context("state tests") test_that("state county tests", {