Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ Authors@R: c(
comment=c(ORCID = "0000-0001-5396-1583")),
person("Michael", "Mahoney", role="ctb",
email = "mjmahoney@usgs.gov",
comment=c(ORCID = "0000-0003-2402-304X"))
comment=c(ORCID = "0000-0003-2402-304X")),
person("Matthew", "Conlon", role="ctb",
email = "mconlon@usgs.gov",
comment=c(ORCID = "0000-0001-8266-9610"))
)
Description: Collection of functions to help retrieve U.S. Geological Survey
and U.S. Environmental Protection Agency water quality and
Expand Down
4 changes: 1 addition & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ export(pCodeToName)
export(parameterCdFile)
export(parse_WQP)
export(pcode_to_name)
export(readNGWMNdata)
export(readNGWMNlevels)
export(readNGWMNsites)
export(readNWISdata)
export(readNWISdv)
export(readNWISpCode)
Expand Down Expand Up @@ -58,6 +55,7 @@ export(read_waterdata_field_measurements)
export(read_waterdata_field_meta)
export(read_waterdata_latest_continuous)
export(read_waterdata_latest_daily)
export(read_waterdata_latest_field_measurements)
export(read_waterdata_metadata)
export(read_waterdata_monitoring_location)
export(read_waterdata_parameter_codes)
Expand Down
5 changes: 4 additions & 1 deletion R/AAA.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ pkg.env <- new.env()
.onLoad <- function(libname, pkgname) {
suppressMessages(setAccess("public"))
pkg.env$local_sf <- requireNamespace("sf", quietly = TRUE)
options("dataRetrieval.nldi_base" = "https://api.water.usgs.gov/nldi/linked-data/")
options(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change from Air formatter? Are there other, old files in the project that haven't been similarly formatted yet and if we could do so in this PR?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a PR awhile back which was a ton of Air formatting updates. Not sure why this didn't make it in back then.

"dataRetrieval.nldi_base" = "https://api.water.usgs.gov/nldi/linked-data/"
)
options("dataRetrieval.api_version" = "v0")
options("dataRetrieval.api_version_stat" = "v0")
options("dataRetrieval.attach_request" = TRUE)
Expand All @@ -21,6 +23,7 @@ pkg.env <- new.env()
"latest-continuous",
"field-measurements",
"latest-daily",
"latest-field-measurements",
"continuous",
"field-measurements-metadata",
"combined-metadata",
Expand Down
226 changes: 0 additions & 226 deletions R/readNGWMNdata.R

This file was deleted.

5 changes: 3 additions & 2 deletions R/read_waterdata_continuous.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#' for new direct download functions that are expected to be available sometime
#' in 2026.
#'
#' Geometry output is not supported in the continuous data API endpoint.
#'
#' @export
#' @param monitoring_location_id `r get_ogc_params("continuous")$monitoring_location_id`
Expand All @@ -35,6 +34,7 @@
#' @param \dots Not used. Included to help differentiate official Water Data API arguments
#' from more seldom used, optional dataRetrieval-specific arguments.
#' @inheritParams check_arguments_non_api
#' @inheritParams check_arguments_api
#'
#' @details
#' You can also use a vector of length 2 for any time queries (such as time
Expand Down Expand Up @@ -120,6 +120,8 @@ read_waterdata_continuous <- function(
value = NA,
last_modified = NA_character_,
time = NA_character_,
skipGeometry = TRUE,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

bbox = NA,
...,
convertType = getOption("dataRetrieval.convertType"),
limit = getOption("dataRetrieval.limit"),
Expand All @@ -132,7 +134,6 @@ read_waterdata_continuous <- function(
rlang::check_dots_empty()

args <- mget(names(formals()))
args[["skipGeometry"]] <- TRUE

return_list <- get_ogc_data(args, output_id, service)

Expand Down
81 changes: 81 additions & 0 deletions R/read_waterdata_latest_field.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#' Get latest USGS field measurement data
#'
#' @description `r get_description("latest-field-measurements")`
#'
#' @export
#' @param monitoring_location_id `r get_ogc_params("latest-field-measurements")$monitoring_location_id`
#' Multiple monitoring_location_ids can be requested as a character vector.
#' @param parameter_code `r get_ogc_params("latest-field-measurements")$parameter_code`
#' Multiple parameter_codes can be requested as a character vector.
#' @param statistic_id `r get_ogc_params("latest-field-measurements")$statistic_id`
#' Multiple statistic_ids can be requested as a character vector.
#' @param time `r get_ogc_params("latest-field-measurements")$time`
#'
#' See also Details below for more information.
#' @param value `r get_ogc_params("latest-field-measurements")$value`
#' @param unit_of_measure `r get_ogc_params("latest-field-measurements")$unit_of_measure`
#' @param approval_status `r get_ogc_params("latest-field-measurements")$approval_status`
#' @param last_modified `r get_ogc_params("latest-field-measurements")$last_modified`
#'
#' See also Details below for more information.
#' @param time_series_id `r get_ogc_params("latest-field-measurements")$time_series_id`
#' Multiple time_series_ids can be requested as a character vector.
#' @param qualifier `r get_ogc_params("latest-field-measurements")$qualifier`
#' @param properties A vector of requested columns to be returned from the query.
#' 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.
#'
#' @inheritParams check_arguments_api
#' @inheritParams check_arguments_non_api
#' @inherit read_waterdata_continuous details
#'
#' @examplesIf is_dataRetrieval_user()
#'
#' \donttest{
#' site <- "USGS-01435000"
#'
#' field_data_sf <- read_waterdata_latest_field_measurements(monitoring_location_id = site)
#'
#' dv_data_trim <- read_waterdata_latest_field_measurements(monitoring_location_id = site,
#' properties = c("monitoring_location_id",
#' "value",
#' "time"))
#'
#' field_data <- read_waterdata_latest_field_measurements(monitoring_location_id = site,
#' skipGeometry = TRUE)
#'
#' multi_site <- read_waterdata_latest_field_measurements(monitoring_location_id = c("USGS-01435000",
#' "USGS-14202650"))
#'
#' }
read_waterdata_latest_field_measurements <- function(
monitoring_location_id = NA_character_,
parameter_code = NA_character_,
statistic_id = NA_character_,
properties = NA_character_,
time_series_id = NA_character_,
approval_status = NA_character_,
unit_of_measure = NA_character_,
qualifier = NA_character_,
value = NA,
last_modified = NA_character_,
skipGeometry = NA,
time = NA_character_,
bbox = NA,
...,
convertType = getOption("dataRetrieval.convertType"),
no_paging = getOption("dataRetrieval.no_paging"),
limit = getOption("dataRetrieval.limit"),
chunk_size = getOption("dataRetrieval.site_chunk_size_meta"),
attach_request = getOption("dataRetrieval.attach_request")
) {
service <- "latest-field-measurements"
output_id <- "latest_field_id"
rlang::check_dots_empty()

args <- mget(names(formals()))
return_list <- get_ogc_data(args, output_id, service)

return(return_list)
}
Loading
Loading