-
Notifications
You must be signed in to change notification settings - Fork 95
Continuous #832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Continuous #832
Changes from 17 commits
4d3ed55
2737c28
c26941d
ce54d74
9472c9b
1df87c3
aea1c58
b7825d2
7a46151
04b7e49
c66862e
64bd04d
6f676ca
bed2283
57132a4
99186ce
d636c59
85568c4
ef26a2f
bf6878f
ebf37f6
84c269e
d28ed5e
10e4106
015f7f3
f6912aa
c3272e7
4bc21b6
23f4f14
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,6 @@ Authors@R: c( | |
| email = "[email protected]", | ||
| comment=c(ORCID = "0000-0003-2521-5043")), | ||
| person("Lee", "Stanish", role="ctb", | ||
| email = "[email protected]", | ||
| comment=c(ORCID = "0000-0002-9775-6861")), | ||
| person("Joeseph", "Zemmels", role="ctb", | ||
| email = "[email protected]", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| #' Get Continuous USGS Water Data | ||
| #' | ||
| #' @description `r get_description("continuous")` | ||
| #' | ||
| #' 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. | ||
| #' | ||
| #' @export | ||
| #' @param monitoring_location_id `r get_params("continuous")$monitoring_location_id` | ||
| #' @param parameter_code `r get_params("continuous")$parameter_code` | ||
| #' @param statistic_id `r get_params("continuous")$statistic_id` | ||
|
||
| #' @param time `r get_params("continuous")$time` | ||
| #' @param value `r get_params("continuous")$value` | ||
| #' @param unit_of_measure `r get_params("continuous")$unit_of_measure` | ||
| #' @param approval_status `r get_params("continuous")$approval_status` | ||
| #' @param last_modified `r get_params("continuous")$last_modified` | ||
| #' @param time_series_id `r get_params("continuous")$time_series_id` | ||
| #' @param qualifier `r get_params("continuous")$qualifier` | ||
| #' @param continuous_id `r get_params("continuous")$id` | ||
| #' @param properties A vector of requested columns to be returned from the query. | ||
| #' Available options are: | ||
| #' `r schema <- check_OGC_requests(endpoint = "continuous", type = "schema"); paste(names(schema$properties), collapse = ", ")` | ||
| #' @param limit The optional limit parameter is used to control the subset of the | ||
| #' selected features that should be returned in each page. The maximum allowable | ||
| #' limit is 50000. It may be beneficial to set this number lower if your internet | ||
| #' connection is spotty. The default (`NA`) will set the limit to the maximum | ||
| #' allowable limit for the service. | ||
| #' @param max_results The optional maximum number of rows to return. This value | ||
| #' must be less than the requested limit. | ||
| #' @param convertType logical, defaults to `TRUE`. If `TRUE`, the function | ||
| #' will convert the data to dates and qualifier to string vector. | ||
| #' @examplesIf is_dataRetrieval_user() | ||
| #' | ||
| #' \donttest{ | ||
| #' site <- "USGS-451605097071701" | ||
| #' pcode <- "72019" | ||
| #' | ||
| #' uv_data_trim <- read_waterdata_continuous(monitoring_location_id = site, | ||
| #' parameter_code = pcode, | ||
| #' properties = c("monitoring_location_id", | ||
| #' "value", | ||
| #' "time")) | ||
| #' | ||
| #' uv_data <- read_waterdata_continuous(monitoring_location_id = site, | ||
| #' parameter_code = pcode, | ||
| #' time = "P2D") | ||
| #' | ||
| #' | ||
| #' # Only return data that has been modified in last 7 days | ||
| #' multi_site2 <- read_waterdata_continuous(monitoring_location_id = c("USGS-451605097071701", | ||
| #' "USGS-14181500"), | ||
| #' parameter_code = c("00060", "72019"), | ||
| #' last_modified = "P7D") | ||
| #' | ||
| #' } | ||
| read_waterdata_continuous <- function(monitoring_location_id = NA_character_, | ||
| parameter_code = NA_character_, | ||
| statistic_id = NA_character_, | ||
| properties = NA_character_, | ||
| time_series_id = NA_character_, | ||
| continuous_id = NA_character_, | ||
| approval_status = NA_character_, | ||
| unit_of_measure = NA_character_, | ||
| qualifier = NA_character_, | ||
| value = NA, | ||
| last_modified = NA_character_, | ||
| time = NA_character_, | ||
| limit = NA, | ||
| max_results = NA, | ||
| convertType = TRUE){ | ||
|
|
||
| service <- "continuous" | ||
| output_id <- "continuous_id" | ||
|
|
||
| args <- mget(names(formals())) | ||
| args[["skipGeometry"]] <- TRUE | ||
|
|
||
| return_list <- get_ogc_data(args, | ||
| output_id, | ||
| service) | ||
|
|
||
| return_list <- return_list[order(return_list$time, return_list$monitoring_location_id), ] | ||
|
|
||
| return(return_list) | ||
| } | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,7 +40,7 @@ If you have additional questions about these changes, email [email protected]. | |
|
|
||
| # What would you like to do? | ||
|
|
||
| 1. Get instantaneous USGS data (for example, discharge sensor data). Start here: `?readNWISuv`. If you only need the latest value, you can use the function: `?read_waterdata_latest_continuous`. | ||
| 1. Get instantaneous USGS data (for example, discharge sensor data). Start here: `?read_waterdata_continuous`. If you only need the latest value, you can use the function: `?read_waterdata_latest_continuous`. | ||
|
|
||
| 2. Get daily USGS data (for example, mean daily discharge). Start here: `?read_waterdata_daily`. If you only need the latest value, you can use the function: `?read_waterdata_latest_daily`. | ||
|
|
||
|
|
@@ -56,6 +56,8 @@ If you have additional questions about these changes, email [email protected]. | |
|
|
||
| 8. Add a USGS WaterData API token to your R environment. See: <https://doi-usgs.github.io/dataRetrieval/articles/read_waterdata_functions.html#api-tokens> | ||
|
|
||
| 9. Get the latest status on NWIS and other data access updates. See: <https://doi-usgs.github.io/dataRetrieval/articles/Status.html> | ||
|
|
||
| For additional tutorials, see: | ||
|
|
||
| [Basic Tutorial](https://doi-usgs.github.io/dataRetrieval/articles/tutorial.html) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a hard and fast rule?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit: asked Mike, got the answer. This is a helpful piece of info!