-
Notifications
You must be signed in to change notification settings - Fork 94
Field measurements #812
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
Field measurements #812
Changes from all commits
5242f6b
38300d6
2c96d87
0feb1fc
faf1892
0ecb2f5
2c4b11b
ba23d81
bf6e04f
ec526e8
9fa93b8
404356d
94e6beb
2e96539
7273c3c
ff84b0f
da80742
89066b9
c866b14
cce05b6
478de58
4c3fbbf
69abd05
6858cdd
38c40ce
b4710fe
1a77133
cea2af2
c39434f
25b794f
c960082
56f9118
f55a221
2fb6b84
ce73b77
6182aac
03a5eb1
72043bf
8776528
3e98ff2
fc89161
af0bbba
6569610
ad9121b
917201f
287563f
8ed0e17
c695abe
e38c5ed
e90343a
f6ea581
e521f49
bfdfb92
18b5c8f
c94de42
e34a459
9e6ce42
8dcc0e2
9e3e561
16786cb
1f30d14
3d08dae
5af8f80
25da695
e80a705
b7951d2
3ec5e05
23fe02e
ea1d6d3
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 |
|---|---|---|
|
|
@@ -12,3 +12,8 @@ docs | |
| /doc/ | ||
| /Meta/ | ||
| /Temp/ | ||
| vignettes/*.html | ||
| vignettes/*.R | ||
|
|
||
|
|
||
| /.quarto/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| --- | ||
| name: New waterdata function | ||
| about: Checklist for adding new USGS waterdata endpoint | ||
| --- | ||
|
|
||
| New features should include all of the following work: | ||
|
|
||
| * [ ] Create the `read_waterdata_` file. File should: | ||
| - [ ] Update endpoint name | ||
| - [ ] Update parameter list in Roxygen section | ||
| - [ ] Update arguments | ||
| - [ ] Update examples | ||
| - [ ] Think about if sorting looks right, if convertType should be used, etc. | ||
| * [ ] Add endpoint name to AAA.R `.onLoad` | ||
| * [ ] Add deprecate notice to corresponding NWIS function | ||
| * [ ] Comment out or delete deprecated NWIS examples | ||
| * [ ] Replace any NWIS tests with new waterdata function | ||
| * [ ] Create new tests in tests/testthat folder for unique situations | ||
| * [ ] Add example to read_waterdata_functions.Rmd vignette | ||
| * [ ] Update Status.Rmd vignette | ||
| * [ ] Update dataRetrieval.Rmd vignette | ||
| * [ ] Update tutorial.Rmd vignette | ||
| * [ ] Update NEWS | ||
| * [ ] Update _pkgdown.yml | ||
| * [ ] Check if README needs to be updated | ||
| * [ ] Update version (for development, only bump up last 4 digits) | ||
| * [ ] Create PR for "develop" branch on GitHub | ||
| * [ ] Create and merge MR for "develop" branch on code.usgs.gov. This will generate development version of documentation. | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| Package: dataRetrieval | ||
| Type: Package | ||
| Title: Retrieval Functions for USGS and EPA Hydrology and Water Quality Data | ||
| Version: 2.7.20 | ||
| Version: 2.7.21 | ||
| Authors@R: c( | ||
| person("Laura", "DeCicco", role = c("aut","cre"), | ||
| email = "[email protected]", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| #' Get USGS Field Measurement Water Data | ||
| #' | ||
| #' @description `r get_description("field-measurements")` | ||
| #' | ||
| #' @export | ||
| #' @param monitoring_location_id `r get_params("field-measurements")$monitoring_location_id` | ||
| #' @param parameter_code `r get_params("field-measurements")$parameter_code` | ||
| #' @param observing_procedure_code `r get_params("field-measurements")$observing_procedure_code` | ||
| #' @param time `r get_params("field-measurements")$time` | ||
| #' @param value `r get_params("field-measurements")$value` | ||
| #' @param unit_of_measure `r get_params("field-measurements")$unit_of_measure` | ||
| #' @param approval_status `r get_params("field-measurements")$approval_status` | ||
| #' @param last_modified `r get_params("field-measurements")$last_modified` | ||
| #' @param qualifier `r get_params("field-measurements")$qualifier` | ||
| #' @param field_visit_id `r get_params("field-measurements")$field_visit_id` | ||
| #' @param observing_procedure `r get_params("field-measurements")$observing_procedure` | ||
| #' @param vertical_datum `r get_params("field-measurements")$vertical_datum` | ||
| #' @param measuring_agency `r get_params("field-measurements")$measuring_agency` | ||
| #' @param properties A vector of requested columns to be returned from the query. | ||
| #' Available options are: | ||
| #' `r schema <- check_OGC_requests(endpoint = "field-measurements", type = "schema"); paste(names(schema$properties), collapse = ", ")` | ||
| #' @param 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 | ||
| #' 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, | ||
ldecicco-USGS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| #' Southern-most latitude, Eastern-most longitude, Northern-most longitude). | ||
| #' @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 10000. 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 skipGeometry This option can be used to skip response geometries for | ||
| #' each feature. The returning object will be a data frame with no spatial | ||
| #' information. | ||
| #' @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-02238500" | ||
| #' field_data_sf <- read_waterdata_field_measurements(monitoring_location_id = site) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there an explanation as to why
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's basically all discrete data that does go to the water quality portal. |
||
| #' | ||
| #' groundwater <- read_waterdata_field_measurements(monitoring_location_id = "USGS-375907091432201") | ||
| #' | ||
| #' gwl_data <- read_waterdata_field_measurements(monitoring_location_id = "USGS-375907091432201", | ||
| #' parameter_code = "72019", | ||
| #' skipGeometry = TRUE) | ||
| #' | ||
| #' gwl_data_period <- read_waterdata_field_measurements( | ||
| #' monitoring_location_id = "USGS-375907091432201", | ||
| #' parameter_code = "72019", | ||
| #' time = "P20Y") | ||
| #' | ||
| #' multi_site <- read_waterdata_field_measurements( | ||
| #' monitoring_location_id = c("USGS-451605097071701", | ||
| #' "USGS-263819081585801"), | ||
| #' parameter_code = c("62611", "72019")) | ||
| #' | ||
| #' old_df <- read_waterdata_field_measurements(monitoring_location_id = "USGS-425957088141001", | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be helpful to have a surface water example, too. These examples led me to check whether "field measurements" was JUST groundwater levels.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried this one for fun and it returned 86 values: |
||
| #' time = c("1980-01-01", NA)) | ||
| #' | ||
| #' | ||
| #' } | ||
| read_waterdata_field_measurements <- function(monitoring_location_id = NA_character_, | ||
| parameter_code = NA_character_, | ||
| observing_procedure_code = NA_character_, | ||
| properties = NA_character_, | ||
| field_visit_id = NA_character_, | ||
| approval_status = NA_character_, | ||
| unit_of_measure = NA_character_, | ||
| qualifier = NA_character_, | ||
| value = NA, | ||
| last_modified = NA_character_, | ||
| observing_procedure = NA_character_, | ||
| vertical_datum = NA_character_, | ||
| measuring_agency = NA_character_, | ||
| skipGeometry = NA, | ||
| time = NA_character_, | ||
| bbox = NA, | ||
| limit = NA, | ||
| max_results = NA, | ||
| convertType = TRUE){ | ||
|
|
||
| service <- "field-measurements" | ||
| output_id <- "field_measurement_id" | ||
|
|
||
| args <- mget(names(formals())) | ||
| 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) | ||
| } | ||
|
|
||
|
|
||
|
|
||
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.
Would be nice to have a set of codes for this. "qualifier" is also quite opaque. In my tests, I see the qualifier "Static" and "".
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.
I hesitate to go off script (all the
r get_params("field-measurements")$qualifiergenerate text about the argument). So, you could bring it up with the API group. But also, I suspect the qualifiers might not be standardized to a small set of options, otherwise they would be available in theread_waterdata_metadatafunction.