Skip to content

Commit c8d0c97

Browse files
Merge pull request DOI-USGS#746 from ldecicco-USGS/add_more_wqx3_docs
Add more wqx3 docs
2 parents a256b0b + 9e0c624 commit c8d0c97

File tree

8 files changed

+127
-49
lines changed

8 files changed

+127
-49
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ jobs:
2121
matrix:
2222
config:
2323
- {os: macos-latest, r: 'release'}
24-
- {os: windows-latest, r: 'release'}
25-
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
26-
- {os: ubuntu-latest, r: 'release'}
27-
- {os: ubuntu-latest, r: 'oldrel-1'}
2824

2925
env:
3026
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

R/readWQPdata.R

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@
4343
#'
4444
#' @param \dots see \url{https://www.waterqualitydata.us/webservices_documentation} for a complete list of options.
4545
#' A list of arguments can also be supplied. For more information see the above
46-
#' description for this help file. If no "service" argument is supplied, it
47-
#' will default to "ResultWQX3". One way to figure out how to construct a WQP query is to go to the "Advanced"
46+
#' description for this help file. One way to figure out how to construct a WQP query is to go to the "Advanced"
4847
#' form in the Water Quality Portal. Use the form to discover what parameters are available. Once the query is
4948
#' set in the form, scroll down to the "Query URL". You will see the parameters
5049
#' after "https://www.waterqualitydata.us/#". For example, if you chose "Nutrient"
@@ -86,12 +85,21 @@
8685
#' @examplesIf is_dataRetrieval_user()
8786
#' \donttest{
8887
#'
88+
#' # Legacy:
8989
#' nameToUse <- "pH"
9090
#' pHData <- readWQPdata(siteid = "USGS-04024315",
9191
#' characteristicName = nameToUse)
9292
#' ncol(pHData)
9393
#' attr(pHData, "siteInfo")
9494
#' attr(pHData, "queryTime")
95+
#' attr(pHData, "url")
96+
#'
97+
#' # WQX3:
98+
#' pHData_wqx3 <- readWQPdata(siteid = "USGS-04024315",
99+
#' characteristicName = nameToUse,
100+
#' service = "ResultWQX3",
101+
#' dataProfile = "basicPhysChem")
102+
#' attr(pHData_wqx3, "url")
95103
#'
96104
#' # More examples:
97105
#' # querying by county
@@ -101,11 +109,30 @@
101109
#' characteristicName = "Nitrogen"
102110
#' )
103111
#'
112+
#' attr(DeWitt, "url")
113+
#'
114+
#' DeWitt_wqx3 <- readWQPdata(
115+
#' statecode = "Illinois",
116+
#' countycode = "DeWitt",
117+
#' characteristicName = "Nitrogen",
118+
#' service = "ResultWQX3",
119+
#' dataProfile = "basicPhysChem",
120+
#' ignore_attributes = TRUE)
121+
#'
122+
#' attr(DeWitt_wqx3, "url")
123+
#'
104124
#' # Data profile: "Sampling Activity"
105125
#' activity <- readWQPdata(
106126
#' siteid = "USGS-04024315",
107127
#' service = "Activity"
108128
#' )
129+
#' attr(activity, "url")
130+
#'
131+
#' activity_wqx3 <- readWQPdata(
132+
#' siteid = "USGS-04024315",
133+
#' service = "ActivityWQX3"
134+
#' )
135+
#' attr(activity_wqx3, "url")
109136
#'
110137
#' Dane_activity <- readWQPdata(
111138
#' statecode = "Wisconsin",
@@ -114,14 +141,20 @@
114141
#' startDateHi = "2023-12-31",
115142
#' service = "Activity"
116143
#' )
144+
#' attr(Dane_activity, "url")
145+
#'
146+
#' Dane_activity_wqx3 <- readWQPdata(
147+
#' statecode = "Wisconsin",
148+
#' countycode = "Dane",
149+
#' startDateLo = "2023-01-01",
150+
#' startDateHi = "2023-12-31",
151+
#' service = "ActivityWQX3"
152+
#' )
153+
#' attr(Dane_activity_wqx3, "url")
117154
#'
118155
#' ########################################################
119156
#' # Additional examples:
120157
#'
121-
#' pHData_legacy <- readWQPdata(siteid = "USGS-04024315",
122-
#' characteristicName = nameToUse,
123-
#' service = "Result",
124-
#' dataProfile = "narrowResult")
125158
#'
126159
#' # Data profiles: "Organization Data"
127160
#' org_data <- readWQPdata(
@@ -157,6 +190,7 @@
157190
#' dataProfile = "biological",
158191
#' service = "Result"
159192
#' )
193+
#'
160194
#'
161195
#' # Data profiles: "Sample Results (narrow)"
162196
#' samp_narrow <- readWQPdata(
@@ -165,6 +199,13 @@
165199
#' dataProfile = "narrowResult"
166200
#' )
167201
#'
202+
#' samp_narrow_wqx3 <- readWQPdata(
203+
#' siteid = "USGS-04024315",
204+
#' service = "ResultWQX3",
205+
#' dataProfile = "narrow"
206+
#' )
207+
#'
208+
#'
168209
#' # Data profiles: "Sampling Activity"
169210
#' samp_activity <- readWQPdata(
170211
#' siteid = "USGS-04024315",

R/readWQPqw.R

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,24 @@
5555
#'
5656
#' attr(rawPcode, "siteInfo")
5757
#' attr(rawPcode, "queryTime")
58-
#'
58+
#' attr(rawPcode, "url")
5959
#'
6060
#' rawCharacteristicName <- readWQPqw("WIDNR_WQX-10032762", "Specific conductance", "", "")
61-
#' rawPHsites <- readWQPqw(c("USGS-05406450", "USGS-05427949", "WIDNR_WQX-133040"), "pH", "", "")
61+
#' pHsites_legacy <- readWQPqw(c("USGS-05406450", "USGS-05427949", "WIDNR_WQX-133040"),
62+
#' "pH", "", "")
63+
#' ncol(pHsites_legacy)
64+
#' attr(pHsites_legacy, "url")
65+
#'
66+
#' pHsites_modern <- readWQPqw(c("USGS-05406450", "USGS-05427949", "WIDNR_WQX-133040"),
67+
#' "pH", "", "", legacy = FALSE)
68+
#' ncol(pHsites_modern)
69+
#' attr(pHsites_modern, "url")
70+
#'
6271
#' nwisEx <- readWQPqw("USGS-04024000", c("34247", "30234", "32104", "34220"), "", "2022-12-20")
6372
#'
64-
#' SC <- readWQPqw(siteNumbers = "USGS-05288705", parameterCd = "00300", convertType = FALSE)
73+
#' SC <- readWQPqw(siteNumbers = "USGS-05288705",
74+
#' parameterCd = "00300",
75+
#' convertType = FALSE)
6576
#' }
6677
readWQPqw <- function(siteNumbers,
6778
parameterCd,

README.Rmd

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,6 @@ The `dataRetrieval` package was created to simplify the process of loading hydro
3333

3434
:warning: USGS discrete water-quality data availability and format are changing. Beginning March 11, 2024 USGS data obtained from legacy services will not include new USGS data or recent updates to existing data. To view the status of changes in data availability and code functionality, visit: <https://doi-usgs.github.io/dataRetrieval/articles/Status.html>
3535

36-
:warning: All documentation on <https://doi-usgs.github.io/dataRetrieval> assume you have the development version of dataRetrieval installed. To do that:
37-
38-
```{r eval=FALSE}
39-
library(remotes)
40-
install_github("DOI-USGS/dataRetrieval",
41-
build_vignettes = TRUE,
42-
build_opts = c("--no-resave-data",
43-
"--no-manual"))
44-
```
45-
4636
If you have additional questions about these changes, email [email protected].
4737

4838
# What would you like to do?

README.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,6 @@ data. To view the status of changes in data availability and code
2323
functionality, visit:
2424
<https://doi-usgs.github.io/dataRetrieval/articles/Status.html>
2525

26-
:warning: All documentation on
27-
<https://doi-usgs.github.io/dataRetrieval> assume you have the
28-
development version of dataRetrieval installed. To do that:
29-
30-
``` r
31-
library(remotes)
32-
install_github("DOI-USGS/dataRetrieval",
33-
build_vignettes = TRUE,
34-
build_opts = c("--no-resave-data",
35-
"--no-manual"))
36-
```
37-
3826
If you have additional questions about these changes, email
3927
4028

@@ -137,14 +125,14 @@ NWIScitation
137125
#> U.S. Geological Survey (2025). _National Water Information System data
138126
#> available on the World Wide Web (USGS Water Data for the Nation)_.
139127
#> doi:10.5066/F7P55KJN <https://doi.org/10.5066/F7P55KJN>, Accessed Feb
140-
#> 03, 2025,
128+
#> 10, 2025,
141129
#> <https://waterservices.usgs.gov/nwis/dv/?site=09010500&format=waterml%2C1.1&ParameterCd=00060&StatCd=00003&startDT=1851-01-01>.
142130
print(NWIScitation, style = "Bibtex")
143131
#> @Manual{,
144132
#> title = {National Water Information System data available on the World Wide Web (USGS Water Data for the Nation)},
145133
#> author = {{U.S. Geological Survey}},
146134
#> doi = {10.5066/F7P55KJN},
147-
#> note = {Accessed Feb 03, 2025},
135+
#> note = {Accessed Feb 10, 2025},
148136
#> year = {2025},
149137
#> url = {https://waterservices.usgs.gov/nwis/dv/?site=09010500&format=waterml%2C1.1&ParameterCd=00060&StatCd=00003&startDT=1851-01-01},
150138
#> }
@@ -168,14 +156,14 @@ WQPcitation <- create_WQP_bib(SC)
168156
WQPcitation
169157
#> National Water Quality Monitoring Council (2025). _Water Quality
170158
#> Portal_. doi:10.5066/P9QRKUVJ <https://doi.org/10.5066/P9QRKUVJ>,
171-
#> Accessed Feb 03, 2025,
159+
#> Accessed Feb 10, 2025,
172160
#> <https://www.waterqualitydata.us/data/Result/search?siteid=USGS-05288705&count=no&pCode=00300&mimeType=csv>.
173161
print(WQPcitation, style = "Bibtex")
174162
#> @Manual{,
175163
#> title = {Water Quality Portal},
176164
#> author = {{National Water Quality Monitoring Council}},
177165
#> doi = {10.5066/P9QRKUVJ},
178-
#> note = {Accessed Feb 03, 2025},
166+
#> note = {Accessed Feb 10, 2025},
179167
#> year = {2025},
180168
#> url = {https://www.waterqualitydata.us/data/Result/search?siteid=USGS-05288705&count=no&pCode=00300&mimeType=csv},
181169
#> }

man/readWQPdata.Rd

Lines changed: 47 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/readWQPqw.Rd

Lines changed: 14 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/dataRetrieval.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ The arguments `startDate` and `endDate` have defaults to request the maximum dat
155155

156156
# USGS Web Retrievals
157157

158-
In this section, examples of National Water Information System (NWIS) retrievals show how to get raw data into R. This data includes [site information](#site-information), measured [parameter information](#parameter-information), historical [daily values](#daily-data), [unit values](#unit-data) (which include real-time data but can also include other sensor data stored at regular time intervals), [water quality data](#water-quality-data), [groundwater level data](#groundwater-level-data), [peak flow data](#peak-flow-data), [rating curve data](#rating-curve-data), [surface-water measurement data](#surface-water-measurement-data), [water use data](#water-use-data), and [statistics data](#statistics-data). The section [Embedded Metadata](#embedded-metadata) shows instructions for getting metadata that is attached to each returned data frame.
158+
In this section, examples of National Water Information System (NWIS) retrievals show how to get raw data into R. This data includes [site information](#site-information), measured [parameter information](#parameter-information), historical [daily values](#daily-data), [unit values](#unit-data) (which include real-time data but can also include other sensor data stored at regular time intervals), [groundwater level data](#groundwater-level-data), [peak flow data](#peak-flow-data), [rating curve data](#rating-curve-data), [surface-water measurement data](#surface-water-measurement-data), [water use data](#water-use-data), and [statistics data](#statistics-data). The section [Embedded Metadata](#embedded-metadata) shows instructions for getting metadata that is attached to each returned data frame.
159159

160160
The USGS organizes hydrologic data in a standard structure. Streamgages are located throughout the United States, and each streamgage has a unique ID (referred in this document and throughout the `dataRetrieval` package as `siteNumber`). Often (but not always), these ID's are 8 digits for surface-water sites and 15 digits for groundwater sites. The first step to finding data is discovering this `siteNumber`. There are many ways to do this, one is the [National Water Information System: Mapper](https://maps.waterdata.usgs.gov/mapper/index.html).
161161

0 commit comments

Comments
 (0)