-
Notifications
You must be signed in to change notification settings - Fork 94
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
Merged
Merged
Continuous #832
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
4d3ed55
First pass
ldecicco-USGS 2737c28
missed again
ldecicco-USGS c26941d
Merge branch 'develop' of https://code.usgs.gov/water/dataRetrieval i…
ldecicco-USGS ce54d74
First pass
ldecicco-USGS 9472c9b
add note
ldecicco-USGS 1df87c3
Update docs
ldecicco-USGS aea1c58
pkgdown
ldecicco-USGS b7825d2
Limit bumped
ldecicco-USGS 7a46151
Update tests
ldecicco-USGS 04b7e49
No bbox for continuous
ldecicco-USGS c66862e
Update docs
ldecicco-USGS 64bd04d
cleanup language
ldecicco-USGS 6f676ca
More wordsmithing.
ldecicco-USGS bed2283
Add a targets example
ldecicco-USGS 57132a4
don't evaluate targets stuff
ldecicco-USGS 99186ce
proper links
ldecicco-USGS d636c59
bad link
ldecicco-USGS 85568c4
Update R/walk_pages.R
ldecicco-USGS ef26a2f
Update vignettes/dataRetrieval.Rmd
ldecicco-USGS bf6878f
Update tutorials/basic_slides_deck.qmd
ldecicco-USGS ebf37f6
Remove id columns from daily/continuous
ldecicco-USGS 84c269e
Push id's to the far right.
ldecicco-USGS d28ed5e
updated news
ldecicco-USGS 10e4106
fixed daily_id select
ldecicco-USGS 015f7f3
Cleanup properties documentation
ldecicco-USGS f6912aa
Update vignettes/tutorial.Rmd
ldecicco-USGS c3272e7
NWIS words
ldecicco-USGS 4bc21b6
Merge branch 'continuous' of github.com:ldecicco-USGS/dataRetrieval i…
ldecicco-USGS 23f4f14
language
ldecicco-USGS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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]", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| #' 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 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 statistic_id `r get_params("continuous")$statistic_id`. Note that | ||
| #' for continuous data, the statistic_id is almost universally 00011. | ||
| #' Requesting anything else will most-likely cause a timeout. | ||
| #' @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)[!names(schema$properties) %in% c("id", "internal_id")], 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, and sepcifically | ||
| #' order the returning data frame by time and monitoring_location_id. | ||
| #' @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("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_, | ||
| properties = NA_character_, | ||
| time_series_id = NA_character_, | ||
| approval_status = NA_character_, | ||
| unit_of_measure = NA_character_, | ||
| qualifier = NA_character_, | ||
| statistic_id = 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 | ||
|
|
||
| if(!is.na(statistic_id) & !all(statistic_id == "00011")){ | ||
| warning("With few if any exceptions, statistic_id is always 00011 for continuous data, and requesting other statistic ids will likely return no data.") | ||
| } | ||
|
|
||
| return_list <- get_ogc_data(args, | ||
| output_id, | ||
| service) | ||
|
|
||
| if(convertType){ | ||
| return_list <- order_results(return_list, properties) | ||
| return_list <- return_list[, names(return_list)[names(return_list)!= output_id]] | ||
| if("time_series_id" %in% names(return_list)){ | ||
| return_list <- return_list[, c( names(return_list)[names(return_list)!= "time_series_id"], | ||
| "time_series_id")] | ||
| } | ||
| } | ||
|
|
||
| return(return_list) | ||
| } | ||
|
|
||
| order_results <- function(return_list, properties){ | ||
|
|
||
| if(all(is.na(properties)) | | ||
| all(c("time", "monitoring_location_id") %in% properties)){ | ||
| return_list <- return_list[order(return_list$time, | ||
| return_list$monitoring_location_id), ] | ||
| } else if ("time" %in% properties) { | ||
| return_list <- return_list[order(return_list$time), ] | ||
| } | ||
|
|
||
| return(return_list) | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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!