-
Notifications
You must be signed in to change notification settings - Fork 90
Update vignette #779
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
Update vignette #779
Conversation
Fix pkgdown See merge request water/dataRetrieval!445
fix NLDI test See merge request water/dataRetrieval!446
…nto update_vignette
@mikemahoney218-usgs @jzemmels @ehinman @cnell-usgs Any feedback would be very much appreciated. I'm hoping this document stays in active development, so this is just a first draft to introduce folks to the functions. |
|
||
Discrete USGS water quality can be accessed via the `read_USGS_samples` function. While this is a new, modern USGS endpoint, it is not served in the same infrastructure as the rest of these new advertised functions. See [Samples Data](articles/samples_data.html)) for information on accessing USGS discrete water quality data. |
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.
Use read_USGS_samples
below instead of “read_USGS_samples”
New functions will use a “snake case”, such as “read_USGS_samples”.
Co-authored-by: Cee Nell <cnell@usgs.gov>
Co-authored-by: Cee Nell <cnell@usgs.gov>
Co-authored-by: Cee Nell <cnell@usgs.gov>
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.
Looks great. A few suggested changes.
vignettes/read_USGS_functions.Rmd
Outdated
fig.height = 4, | ||
fig.width = 7 | ||
) | ||
``` | ||
|
||
|
||
As we bid adieu to the NWIS web services, we welcome a new web service offering, the USGS Water Data OGC APIs. | ||
As we bid adieu to the NWIS web services, we welcome a host of new web service offering: the [USGS Water Data OGC APIs](https://api.waterdata.usgs.gov/ogcapi/v0/). This is a modern access point for USGS water data. The USGS is planning to modernize **all** web services in the near future. For each of these updates, `dataRetrieval` will create a new function to access the new services. |
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.
Explicitly mention that old services will be decommissioned also.
As we bid adieu to the NWIS web services, we welcome a host of new web service offering: the [USGS Water Data OGC APIs](https://api.waterdata.usgs.gov/ogcapi/v0/). This is a modern access point for USGS water data. The USGS is planning to modernize **all** web services in the near future. For each of these updates, `dataRetrieval` will create a new function to access the new services. | |
As we bid adieu to the NWIS web services, we welcome a host of new web service offering: the [USGS Water Data OGC APIs](https://api.waterdata.usgs.gov/ogcapi/v0/). This is a modern access point for USGS water data. The USGS is planning to modernize **all** web services in the near future. For each of these updates, `dataRetrieval` will create a new function to access the new services and deprecate functions for accessing the legacy services. |
The returned data includes a column "geometry" which is a collection of simple feature (sf) points. This allows for seamless integration with the `sf` package. Here are 2 quick examples of using the `sf` object in ggplot2 and leaflet: | ||
|
||
```{r} | ||
library(ggplot2) |
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.
SC: sf
is suggested, so installation may be required for new users.
library(ggplot2) | |
# install.packages("sf") | |
library(ggplot2) |
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.
We added sf
as an Import (before it was just a suggestion), so presumably any user who uses the new version should have it. So, I'm not sure this is a great place for that, but I should update the Dependency section below (when I first started writing this up we were still debating keeping it as suggest vs import.)
The issue I've seen with including commented out install instructions like this is that folks tend to uncomment it and have consistently have fresh installs of that one package (in this case "sf"), and then CRAZY outdated packages everywhere else.
vignettes/read_USGS_functions.Rmd
Outdated
|
||
The `read_USGS_monitoring_location` function will eventually replace the `readNWISsite` function. Generally, both functions look pretty similar: | ||
daily_modern <- read_USGS_daily(monitoring_location_id = "USGS-01491000", | ||
parameter_code = c("00060", "00010"), |
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.
SC: add extra whitespace to these lines so function arguments are horizontally aligned.
Co-authored-by: Joe Zemmels (he/him) <jzemmels@gmail.com>
Co-authored-by: Joe Zemmels (he/him) <jzemmels@gmail.com>
Co-authored-by: Joe Zemmels (he/him) <jzemmels@gmail.com>
Co-authored-by: Joe Zemmels (he/him) <jzemmels@gmail.com>
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.
Super exciting seeing this!
@@ -27,7 +27,7 @@ library(dataRetrieval) | |||
[](https://cran.r-project.org/package=dataRetrieval) | |||
[](https://cran.r-project.org/package=dataRetrieval) | |||
|
|||
The `dataRetrieval` package was created to simplify the process of loading hydrologic data into the R environment. It is designed to retrieve the major data types of U.S. Geological Survey (USGS) hydrology data that are available on the Web, as well as data from the Water Quality Portal (WQP), which currently houses water quality data from the Environmental Protection Agency (EPA), U.S. Department of Agriculture (USDA), and USGS. Direct USGS data is obtained from a service called the National Water Information System (NWIS). | |||
The `dataRetrieval` package was created to simplify the process of loading hydrologic data into the R environment. It is designed to retrieve the major data types of U.S. Geological Survey (USGS) hydrology data that are available on the Web, as well as data from the Water Quality Portal (WQP), which currently houses water quality data from the Environmental Protection Agency (EPA), U.S. Department of Agriculture (USDA), and USGS. |
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.
No opinion on whether this sentence is kept or removed, but the new APIs are still part of NWIS -- alongside the rest of the apis on api.waterdata.usgs.gov . We need to think through the branding better, frankly.
|
||
2. Get daily USGS discharge data. Start here: `?readNWISdv` | ||
2. Get daily USGS data (for example, mean daily discharge). Start here: `?read_USGS_daily` |
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.
❤️
README.Rmd
Outdated
|
||
6. Find Hydro Network-Linked Data Index (NLDI) data. Start here: `?findNLDI` | ||
6. Discover USGS time series data. Start here: `?read_USGS_ts_meta` |
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.
This might make more sense as Get metadata about USGS time series data, including instantaneous and daily data
, perhaps?
vignettes/read_USGS_functions.Rmd
Outdated
fig.height = 4, | ||
fig.width = 7 | ||
) | ||
``` | ||
|
||
|
||
As we bid adieu to the NWIS web services, we welcome a new web service offering, the USGS Water Data OGC APIs. | ||
As we bid adieu to the NWIS web services, we welcome a host of new web service offering: the [USGS Water Data OGC APIs](https://api.waterdata.usgs.gov/ogcapi/v0/). This is a modern access point for USGS water data. The USGS is planning to modernize **all** web services in the near future. For each of these updates, `dataRetrieval` will create a new function to access the new services. |
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.
This spooks me a bit:
The USGS is planning to modernize all web services in the near future
Maybe:
The USGS will be modernizing all of the NWIS web services in the near future
vignettes/read_USGS_functions.Rmd
Outdated
``` | ||
API_USGS_PAT = "my_super_secret_token" | ||
``` | ||
You can use `usethis::edit_r_environ()` to edit find and open your .Renviron file. You will need to restart R for that variable to be recognized. |
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.
Maybe mention "you should not add this file to git projects or share your API key, generally. Anyone else using your API key will count against the number of requests available to you!" or something similar about keeping secrets secret
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.
This looks and reads very well, @ldecicco-USGS! I especially loved the CQL section. Seems very cool. Made a few minor wording suggestions, plus a question about the term "NWIS".
vignettes/read_USGS_functions.Rmd
Outdated
fig.height = 4, | ||
fig.width = 7 | ||
) | ||
``` | ||
|
||
|
||
As we bid adieu to the NWIS web services, we welcome a new web service offering, the USGS Water Data OGC APIs. | ||
As we bid adieu to the NWIS web services, we welcome a host of new web service offering: the [USGS Water Data OGC APIs](https://api.waterdata.usgs.gov/ogcapi/v0/). This is a modern access point for USGS water data. The USGS is planning to modernize **all** web services in the near future. For each of these updates, `dataRetrieval` will create a new function to access the new services. |
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.
As we bid adieu to the NWIS web services, we welcome a host of new web service offering: the [USGS Water Data OGC APIs](https://api.waterdata.usgs.gov/ogcapi/v0/). This is a modern access point for USGS water data. The USGS is planning to modernize **all** web services in the near future. For each of these updates, `dataRetrieval` will create a new function to access the new services. | |
As we bid adieu to the NWIS web services, we welcome a host of new web service offerings: the [USGS Water Data OGC APIs](https://api.waterdata.usgs.gov/ogcapi/v0/). This is a modern access point for USGS water data. The USGS is planning to modernize **all** web services in the near future. For each of these updates, `dataRetrieval` will create a new function to access the new services. |
vignettes/read_USGS_functions.Rmd
Outdated
fig.height = 4, | ||
fig.width = 7 | ||
) | ||
``` | ||
|
||
|
||
As we bid adieu to the NWIS web services, we welcome a new web service offering, the USGS Water Data OGC APIs. | ||
As we bid adieu to the NWIS web services, we welcome a host of new web service offering: the [USGS Water Data OGC APIs](https://api.waterdata.usgs.gov/ogcapi/v0/). This is a modern access point for USGS water data. The USGS is planning to modernize **all** web services in the near future. For each of these updates, `dataRetrieval` will create a new function to access the new services. |
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.
May need to have a larger communication conversation about this. @mikemahoney218-usgs please chime in since you're way more in the know....will we be using the term NWIS to describe these services in the future? Are we really saying "goodbye" to NWIS web services, or just modernizing them? If dataRetrieval stops referring to NWIS but it is referred to elsewhere in USGS documentation...is that confusing?
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.
A simple fix might be to replace NWIS with "WaterServices".
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.
NWIS is the broadest possible umbrella containing almost the entire water observing system. Our group owns "NWIS Delivery", which covers WDFN, WQP, WaterAlert, STN, RT-FIM, NGWMN, NWD, comptools, the new APIs, and so on. But NWIS itself also includes AQTS, AQS, MLR, NIMS, TID, DECAP, DIRS, RLMS... there's a few dozen other acronyms included, everything that's required to keep the data flowing. We'll be continuing to call this system NWIS going forward (the replacement for the current NWISMod will be called NWIS). The purpose of api.waterdata.usgs.gov is to be "a catalog of all modernized NWIS APIs" going forward -- that's why it includes now RTFI-API, for instance.
That said, we're moving away from tagging each of the subcomponents as "NWIS" -- rather than "NWISWeb" and "NWISMapper", it's now "WDFN" and "Explore USGS Water Data" and "How to access USGS data in QGIS" and so on.
Maybe that answers the question?
vignettes/read_USGS_functions.Rmd
Outdated
|
||
`r dataRetrieval:::get_description("daily")` | ||
* Any column that is returned can also be queried on! The main `dataRetrieval` functions will take vector inputs. Each query is appended as a boolean AND. For instance, if you ask for a vector of monitoring location ids and a vector of parameter codes, you will get data back for just those monitoring locations AND the specified parameter codes. Towards the bottom of this document, we'll discuss ways to make more specific queries using "Common Query Language" or CQL. |
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 find this statement a little bit confusing, since it seems like the example given here is how you would get specific sites/characteristics from USGS Samples, WQP, any of the services. You could provide a more novel example, like "For instance, you may only want daily observations above a certain value...."
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.
Ah, now re-reading, I see how the "AND" part is unique...whereas with the other services, it would be an "OR"? Maybe here you could specify why this example is different from how Samples or legacy NWIS or the WQP works.
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'll work on a re-write to hopefully clarify. It's not necessarily unique to this service - but it is unique to the way dataRetrieval does it (because the API is expecting the CQL which is way more flexible than a bunch of ANDs)
Co-authored-by: Elise Hinman <121896266+ehinman@users.noreply.github.com>
Co-authored-by: Elise Hinman <121896266+ehinman@users.noreply.github.com>
Co-authored-by: Cee Nell <cnell@usgs.gov>
vignettes/read_USGS_functions.Rmd
Outdated
|
||
If you find yourself running into limits, you can request an API token here: <https://api.waterdata.usgs.gov/signup/> | ||
The new APIs can handle complex requests. For those queries, users will need to construct their own request using Common Query Language. There's an excellent article <https://api.waterdata.usgs.gov/docs/ogcapi/complex-queries/>. |
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.
So here's a weird one... we use CQL2. Which OGC always refers to as "Common Query Language" and never calls "version 2". Not sure if it's worth specifying "(CQL2)" after the full name is spelled out?
Merge branch 'update_vignette' of github.com:ldecicco-USGS/dataRetrieval into update_vignette # Conflicts: # vignettes/read_USGS_functions.Rmd
No description provided.