Skip to content

Commit

Permalink
Merge pull request #710 from ldecicco-USGS/main
Browse files Browse the repository at this point in the history
Small documentation updates
  • Loading branch information
ldecicco-USGS authored Jun 15, 2024
2 parents 65e1778 + 775c2cb commit c355515
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 106 deletions.
15 changes: 14 additions & 1 deletion R/readNWISdv.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#' Daily Value USGS NWIS Data Retrieval
#'
#' Imports data from NWIS web service. This function gets the data from here: \url{https://waterservices.usgs.gov/}
#' Imports data from NWIS daily web service. This function gets the data from here:
#' \url{https://waterservices.usgs.gov/docs/dv-service/daily-values-service-details/}
#' Inputs to this function are just USGS site ids, USGS parameter codes,
#' USGS statistic codes, and start and end date. For a more complex query, use \code{\link{readNWISdata}},
#' with an argument service = "dv".
#' Data coming the daily web services are aggregates of the instantaneous
#' (sensor) web services. Not all statistical codes are available for all data.
#' Use the function \code{\link{whatNWISdata}} to discover what data
#' is available for a USGS site. The column data_type_cd with the values "dv"
#' returned from \code{\link{whatNWISdata}}) are available from this service.
#'
#' More information on the web service can be found here:
#' \url{https://waterservices.usgs.gov/test-tools}, choosing the
#' "Daily Value Service".
#'
#' @param siteNumbers character USGS site number. This is usually an 8 digit number.
#' Multiple sites can be requested with a character vector.
Expand Down
34 changes: 27 additions & 7 deletions R/readNWISunit.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
#' Instantaneous value data retrieval from USGS (NWIS)
#'
#' Imports data from NWIS web service. This function gets the data from here:
#' \url{https://waterservices.usgs.gov/}
#' A list of parameter codes can be found here:
#' \url{https://nwis.waterdata.usgs.gov/nwis/pmcodes/}
#' A list of statistic codes can be found here:
#' \url{https://nwis.waterdata.usgs.gov/nwis/help/?read_file=stat&format=table}.
#' \url{https://waterservices.usgs.gov/docs/instantaneous-values/instantaneous-values-details/}
#' Inputs to this function are just USGS site ids, USGS parameter codes,
#' and start and end date. For a more complex query, use \code{\link{readNWISdata}},
#' including an arguement service="uv".
#' Not all parameter codes are available for all data.
#' Use the function \code{\link{whatNWISdata}} to discover what data
#' is available for a USGS site. The column data_type_cd with the values "uv"
#' returned from \code{\link{whatNWISdata}}) are available from this service.
#'
#' More information on the web service can be found here:
#' \url{https://waterservices.usgs.gov/docs/instantaneous-values/}.
#' \url{https://waterservices.usgs.gov/test-tools}, choosing the
#' "Instantaneous Value Service".
#'
#' @param siteNumbers character USGS site number (or multiple sites). This is usually an 8 digit number
#' @param parameterCd character USGS parameter code. This is usually an 5 digit number.
Expand Down Expand Up @@ -421,7 +426,22 @@ readNWISmeas <- function(siteNumbers,

#' Groundwater level measurements retrieval from USGS (NWIS)
#'
#' Reads groundwater level measurements from NWISweb. Mixed date/times come back from the service
#' Imports groundwater level data from NWIS web service. This function gets the data from here:
#' \url{https://waterservices.usgs.gov/docs/groundwater-levels/groundwater-levels-details/}
#' Inputs to this function are just USGS site ids, USGS parameter codes,
#' and start and end date. For a more complex query, use \code{\link{readNWISdata}},
#' including an argument service="gwlevels".
#' Not all parameter codes are available for all data.
#' Use the function \code{\link{whatNWISdata}} to discover what data
#' is available for a USGS site. The column data_type_cd with the values "gw"
#' returned from \code{\link{whatNWISdata}}) are available from this service.
#'
#' More information on the web service can be found here:
#' \url{https://waterservices.usgs.gov/test-tools}, choosing the
#' "Groundwater Levels Value Service".
#'
#'
#' Mixed date/times come back from the service
#' depending on the year that the data was collected. See \url{https://waterdata.usgs.gov/usa/nwis/gw}
#' for details about groundwater. By default the returned dates are converted to date objects, unless convertType
#' is specified as FALSE. Sites with non-standard date formats (i.e. lacking a day) can be affected (see examples).
Expand Down
1 change: 0 additions & 1 deletion R/readWQPdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#'
#' Imports data from Water Quality Portal web service. This function gets the data from here:
#' \url{https://www.waterqualitydata.us}.
#' because it allows for other agencies rather than the USGS.
#'
#' This function uses \dots as a query input, which can be very flexible, but also
#' has a steeper learning curve. For a quick overview, scroll down to the Examples
Expand Down
43 changes: 1 addition & 42 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ If you have additional questions about these changes, email [email protected].

4. Discover USGS data (not including discrete water quality data). Start here: `?whatNWISdata`

6. Discover discrete water quality data. Start here: `?readWQPsummary`
6. Find Hydro Network-Linked Data Index (NLDI) data. Start here: `?get_nldi`

For additional tutorials, see:

Expand All @@ -56,47 +56,6 @@ For additional tutorials, see:
[dataRetrieval Introduction 2](https://rconnect.usgs.gov/NMC_dataRetrieval_2)


# Sample Workflow

## USGS

```{r workUSGS, eval=FALSE}
library(dataRetrieval)
# Choptank River near Greensboro, MD
siteNumber <- "01491000"
ChoptankInfo <- readNWISsite(siteNumber)
parameterCd <- "00060"
# Raw daily data:
rawDailyData <- readNWISdv(
siteNumber, parameterCd,
"1980-01-01", "2010-01-01"
)
pCode <- readNWISpCode(parameterCd)
```

## Water Quality Portal

```{r WQP, eval=FALSE}
specificCond <- readWQPqw(
siteNumbers = "WIDNR_WQX-10032762",
parameterCd = "Specific conductance",
startDate = "2011-05-01",
endDate = "2011-09-30"
)
```

## Network Linked Data Index

```{r NLDI, eval=FALSE}
features <- findNLDI(
nwis = "01491000",
nav = "UT",
find = c("basin", "wqp")
)
```

# Installation of dataRetrieval

To install the `dataRetrieval` package, you must be using R 3.0 or greater and run the following command:
Expand Down
52 changes: 6 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ If you have additional questions about these changes, email
5. Discover USGS data (not including discrete water quality data).
Start here: `?whatNWISdata`

6. Discover discrete water quality data. Start here: `?readWQPsummary`
6. Find Hydro Network-Linked Data Index (NLDI) data. Start here:
`?get_nldi`

For additional tutorials, see:

Expand All @@ -50,47 +51,6 @@ Tutorial](https://doi-usgs.github.io/dataRetrieval/articles/tutorial.html)
[dataRetrieval Introduction
2](https://rconnect.usgs.gov/NMC_dataRetrieval_2)

# Sample Workflow

## USGS

``` r
library(dataRetrieval)
# Choptank River near Greensboro, MD
siteNumber <- "01491000"
ChoptankInfo <- readNWISsite(siteNumber)
parameterCd <- "00060"

# Raw daily data:
rawDailyData <- readNWISdv(
siteNumber, parameterCd,
"1980-01-01", "2010-01-01"
)

pCode <- readNWISpCode(parameterCd)
```

## Water Quality Portal

``` r
specificCond <- readWQPqw(
siteNumbers = "WIDNR_WQX-10032762",
parameterCd = "Specific conductance",
startDate = "2011-05-01",
endDate = "2011-09-30"
)
```

## Network Linked Data Index

``` r
features <- findNLDI(
nwis = "01491000",
nav = "UT",
find = c("basin", "wqp")
)
```

# Installation of dataRetrieval

To install the `dataRetrieval` package, you must be using R 3.0 or
Expand Down Expand Up @@ -163,7 +123,7 @@ NWIScitation
#> U.S. Geological Survey (2024). _National Water Information System data
#> available on the World Wide Web (USGS Water Data for the Nation)_.
#> doi:10.5066/F7P55KJN <https://doi.org/10.5066/F7P55KJN>, Accessed Jun
#> 10, 2024,
#> 14, 2024,
#> <https://waterservices.usgs.gov/nwis/dv/?site=09010500&format=waterml,1.1&ParameterCd=00060&StatCd=00003&startDT=1851-01-01>.
```

Expand All @@ -173,7 +133,7 @@ print(NWIScitation, style = "Bibtex")
#> title = {National Water Information System data available on the World Wide Web (USGS Water Data for the Nation)},
#> author = {{U.S. Geological Survey}},
#> doi = {10.5066/F7P55KJN},
#> note = {Accessed Jun 10, 2024},
#> note = {Accessed Jun 14, 2024},
#> year = {2024},
#> url = {https://waterservices.usgs.gov/nwis/dv/?site=09010500&format=waterml,1.1&ParameterCd=00060&StatCd=00003&startDT=1851-01-01},
#> }
Expand All @@ -197,7 +157,7 @@ WQPcitation <- create_WQP_bib(SC)
WQPcitation
#> National Water Quality Monitoring Council (2024). _Water Quality
#> Portal_. doi:10.5066/P9QRKUVJ <https://doi.org/10.5066/P9QRKUVJ>,
#> Accessed Jun 10, 2024,
#> Accessed Jun 15, 2024,
#> <https://www.waterqualitydata.us/wqx3/Result/search?siteid=USGS-05288705&pCode=00300&mimeType=csv&dataProfile=narrow>.
```

Expand All @@ -207,7 +167,7 @@ print(WQPcitation, style = "Bibtex")
#> title = {Water Quality Portal},
#> author = {{National Water Quality Monitoring Council}},
#> doi = {10.5066/P9QRKUVJ},
#> note = {Accessed Jun 10, 2024},
#> note = {Accessed Jun 15, 2024},
#> year = {2024},
#> url = {https://www.waterqualitydata.us/wqx3/Result/search?siteid=USGS-05288705&pCode=00300&mimeType=csv&dataProfile=narrow},
#> }
Expand Down
16 changes: 15 additions & 1 deletion man/readNWISdv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion man/readNWISgwl.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 12 additions & 6 deletions man/readNWISuv.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/readWQPdata.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c355515

Please sign in to comment.