Unverified Commit b60c41a2 authored by Laura A DeCicco's avatar Laura A DeCicco Committed by GitHub
Browse files

Merge pull request #582 from ldecicco-USGS/master

Try some new roxygen2 fanciness
parents 87705271 9be10fc9
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
#' #'
#' @export #' @export
#' @seealso whatNWISdata #' @seealso whatNWISdata
#' @examples #' @examplesIf is_dataRetrieval_user()
#' \donttest{ #' \donttest{
#' #'
#' site1 <- whatWQPsites(siteid="USGS-01594440") #' site1 <- whatWQPsites(siteid="USGS-01594440")
......
# dataRetrieval <img src="man/figures/logo.png" alt="dataRetrieval" height="150px" align="right" /> # dataRetrieval <img src="man/figures/logo.png" alt="dataRetrieval" height="150px" align="right" />
[![R build status](https://github.com/USGS-R/dataRetrieval/workflows/R-CMD-check/badge.svg)](https://github.com/USGS-R/dataRetrieval/actions)[![Coverage Status](https://coveralls.io/repos/github/USGS-R/dataRetrieval/badge.svg?branch=master)](https://coveralls.io/github/USGS-R/dataRetrieval?branch=master) [![status](https://img.shields.io/badge/USGS-Core-green.svg)](https://owi.usgs.gov/R/packages.html#core) [![CRAN version](http://www.r-pkg.org/badges/version/dataRetrieval)](https://cran.r-project.org/package=dataRetrieval) [![](http://cranlogs.r-pkg.org/badges/dataRetrieval)](https://cran.r-project.org/package=dataRetrieval) [![](http://cranlogs.r-pkg.org/badges/grand-total/dataRetrieval)](https://cran.r-project.org/package=dataRetrieval)
Retrieval functions for USGS and EPA hydrologic and water quality data. Retrieval functions for USGS and EPA hydrologic and water quality data.
For complete tutorial information, see: For complete tutorial information, see:
......
...@@ -18,8 +18,6 @@ navbar: ...@@ -18,8 +18,6 @@ navbar:
href: articles/movingAverages.html href: articles/movingAverages.html
- text: Stat Service - text: Stat Service
href: articles/statsServiceMap.html href: articles/statsServiceMap.html
- text: Earthquake Exploration
href: articles/earthquake.html
- text: NLDI Interface - text: NLDI Interface
href: articles/nldi.html href: articles/nldi.html
right: right:
...@@ -63,6 +61,15 @@ reference: ...@@ -63,6 +61,15 @@ reference:
desc: Functions to interface with the NLDI. desc: Functions to interface with the NLDI.
contents: contents:
- findNLDI - findNLDI
- get_nldi_sources
- title: Import data
desc: Functions to import different data formats
contents:
- importRDB1
- importNGWMN
- importWaterML1
- importWaterML2
- importWQP
- title: Helper functions - title: Helper functions
contents: contents:
- calcWaterYear - calcWaterYear
...@@ -71,4 +78,17 @@ reference: ...@@ -71,4 +78,17 @@ reference:
- setAccess - setAccess
- countyCdLookup - countyCdLookup
- stateCdLookup - stateCdLookup
- countyCd
- parameterCdFile
- stateCd
- zeroPad - zeroPad
- dataRetrieval
- title: Web query utilities
desc: Functions to create web queries
contents:
- constructNWISURL
- constructUseURL
- constructWQPURL
- getQuerySummary
- getWebServiceData
- is_dataRetrieval_user
...@@ -65,6 +65,7 @@ navigated paths. Valid starting options can be given by one of the following ...@@ -65,6 +65,7 @@ navigated paths. Valid starting options can be given by one of the following
arguments: comid, nwis, huc12, wqp, location, and start. arguments: comid, nwis, huc12, wqp, location, and start.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
\donttest{ \donttest{
# Find Features / Define origin features # Find Features / Define origin features
...@@ -106,5 +107,6 @@ arguments: comid, nwis, huc12, wqp, location, and start. ...@@ -106,5 +107,6 @@ arguments: comid, nwis, huc12, wqp, location, and start.
## Limit search to 50 km ## Limit search to 50 km
findNLDI(comid = 101, nav = "DM", find = c("nwis", "wqp", "flowlines"), distance_km = 50) findNLDI(comid = 101, nav = "DM", find = c("nwis", "wqp", "flowlines"), distance_km = 50)
} }
\dontshow{\}) # examplesIf}
} }
\keyword{nldi} \keyword{nldi}
...@@ -19,6 +19,7 @@ This function accepts a url parameter, and returns the raw data. The function en ...@@ -19,6 +19,7 @@ This function accepts a url parameter, and returns the raw data. The function en
\code{\link[httr]{GET}} with more informative error messages. \code{\link[httr]{GET}} with more informative error messages.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
siteNumber <- "02177000" siteNumber <- "02177000"
startDate <- "2012-09-01" startDate <- "2012-09-01"
endDate <- "2012-10-01" endDate <- "2012-10-01"
...@@ -28,4 +29,5 @@ obs_url <- constructNWISURL(siteNumber,property,startDate,endDate,'dv') ...@@ -28,4 +29,5 @@ obs_url <- constructNWISURL(siteNumber,property,startDate,endDate,'dv')
\donttest{ \donttest{
rawData <- getWebServiceData(obs_url) rawData <- getWebServiceData(obs_url)
} }
\dontshow{\}) # examplesIf}
} }
...@@ -55,6 +55,7 @@ NWIS site, parameter code, statistic, startdate and enddate. It is not ...@@ -55,6 +55,7 @@ NWIS site, parameter code, statistic, startdate and enddate. It is not
recommended to use the RDB format for importing multi-site data. recommended to use the RDB format for importing multi-site data.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
site_id <- "02177000" site_id <- "02177000"
startDate <- "2012-09-01" startDate <- "2012-09-01"
endDate <- "2012-10-01" endDate <- "2012-10-01"
...@@ -97,5 +98,5 @@ filePath <- system.file("extdata", package="dataRetrieval") ...@@ -97,5 +98,5 @@ filePath <- system.file("extdata", package="dataRetrieval")
fileName <- "RDB1Example.txt" fileName <- "RDB1Example.txt"
fullPath <- file.path(filePath, fileName) fullPath <- file.path(filePath, fileName)
importUserRDB <- importRDB1(fullPath) importUserRDB <- importRDB1(fullPath)
\dontshow{\}) # examplesIf}
} }
...@@ -26,6 +26,7 @@ start and end times, and converted to UTC. See \url{https://www.waterqualitydata ...@@ -26,6 +26,7 @@ start and end times, and converted to UTC. See \url{https://www.waterqualitydata
Imports data from the Water Quality Portal based on a specified url. Imports data from the Water Quality Portal based on a specified url.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
# These examples require an internet connection to run # These examples require an internet connection to run
## Examples take longer than 5 seconds: ## Examples take longer than 5 seconds:
...@@ -42,7 +43,7 @@ STORETex <- constructWQPURL('WIDNR_WQX-10032762','Specific conductance', '', '') ...@@ -42,7 +43,7 @@ STORETex <- constructWQPURL('WIDNR_WQX-10032762','Specific conductance', '', '')
STORETdata <- importWQP(STORETex) STORETdata <- importWQP(STORETex)
} }
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{readWQPdata}}, \code{\link{readWQPqw}}, \code{\link{whatWQPsites}} \code{\link{readWQPdata}}, \code{\link{readWQPqw}}, \code{\link{whatWQPsites}}
......
...@@ -50,6 +50,7 @@ This function accepts a url parameter that already contains the desired ...@@ -50,6 +50,7 @@ This function accepts a url parameter that already contains the desired
NWIS site, parameter code, statistic, startdate and enddate. NWIS site, parameter code, statistic, startdate and enddate.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
site_id <- "02177000" site_id <- "02177000"
startDate <- "2012-09-01" startDate <- "2012-09-01"
endDate <- "2012-10-01" endDate <- "2012-10-01"
...@@ -103,7 +104,7 @@ filePath <- system.file("extdata", package="dataRetrieval") ...@@ -103,7 +104,7 @@ filePath <- system.file("extdata", package="dataRetrieval")
fileName <- "WaterML1Example.xml" fileName <- "WaterML1Example.xml"
fullPath <- file.path(filePath, fileName) fullPath <- file.path(filePath, fileName)
importFile <- importWaterML1(fullPath,TRUE) importFile <- importWaterML1(fullPath,TRUE)
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{renameNWISColumns}} \code{\link{renameNWISColumns}}
......
...@@ -21,6 +21,7 @@ Returns data frame columns of all information with each time series measurement; ...@@ -21,6 +21,7 @@ Returns data frame columns of all information with each time series measurement;
Anything defined as a default, is returned as an attribute of that data frame. Anything defined as a default, is returned as an attribute of that data frame.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
baseURL <- "https://waterservices.usgs.gov/nwis/dv/?format=waterml,2.0" baseURL <- "https://waterservices.usgs.gov/nwis/dv/?format=waterml,2.0"
URL <- paste(baseURL, "sites=01646500", URL <- paste(baseURL, "sites=01646500",
"startDT=2014-09-01", "startDT=2014-09-01",
...@@ -32,4 +33,5 @@ URL <- paste(baseURL, "sites=01646500", ...@@ -32,4 +33,5 @@ URL <- paste(baseURL, "sites=01646500",
timesereies <- importWaterML2(URL, asDateTime=TRUE, tz="UTC") timesereies <- importWaterML2(URL, asDateTime=TRUE, tz="UTC")
} }
\dontshow{\}) # examplesIf}
} }
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/AAA.R
\name{is_dataRetrieval_user}
\alias{is_dataRetrieval_user}
\title{Is this a dataRetrieval user}
\usage{
is_dataRetrieval_user()
}
\description{
Reveals if this is a user or not
}
\examples{
is_dataRetrieval_user()
}
...@@ -25,6 +25,7 @@ for more information on time zones.} ...@@ -25,6 +25,7 @@ for more information on time zones.}
Only water level data and site locations and names are currently available through the web service. Only water level data and site locations and names are currently available through the web service.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
\donttest{ \donttest{
#one site #one site
site <- "USGS.430427089284901" site <- "USGS.430427089284901"
...@@ -52,5 +53,5 @@ noDataSite <- "UTGS.401544112060301" ...@@ -52,5 +53,5 @@ noDataSite <- "UTGS.401544112060301"
#bboxData <- readNGWMNdata(service = "observation", siteNumbers = bboxSites$site[1:3], #bboxData <- readNGWMNdata(service = "observation", siteNumbers = bboxSites$site[1:3],
#asDateTime = FALSE) #asDateTime = FALSE)
} }
\dontshow{\}) # examplesIf}
} }
...@@ -65,6 +65,7 @@ Arguments to the function should be based on \url{https://waterservices.usgs.gov ...@@ -65,6 +65,7 @@ Arguments to the function should be based on \url{https://waterservices.usgs.gov
See examples below for ideas of constructing queries. See examples below for ideas of constructing queries.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
\donttest{ \donttest{
# Examples not run for time considerations # Examples not run for time considerations
...@@ -142,6 +143,7 @@ peak_data <- readNWISdata(service = "peak", ...@@ -142,6 +143,7 @@ peak_data <- readNWISdata(service = "peak",
} }
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{renameNWISColumns}}, \code{\link{importWaterML1}}, \code{\link{importRDB1}} \code{\link{renameNWISColumns}}, \code{\link{importWaterML1}}, \code{\link{importRDB1}}
......
...@@ -55,6 +55,7 @@ queryTime \tab POSIXct \tab The time the data was returned \cr ...@@ -55,6 +55,7 @@ queryTime \tab POSIXct \tab The time the data was returned \cr
Imports data from NWIS web service. This function gets the data from here: \url{https://waterservices.usgs.gov/} Imports data from NWIS web service. This function gets the data from here: \url{https://waterservices.usgs.gov/}
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
site_id <- '04085427' site_id <- '04085427'
startDate <- '2012-01-01' startDate <- '2012-01-01'
endDate <- '2012-06-30' endDate <- '2012-06-30'
...@@ -75,6 +76,7 @@ attr(x, "variableInfo") ...@@ -75,6 +76,7 @@ attr(x, "variableInfo")
site <- "05212700" site <- "05212700"
notActive <- readNWISdv(site, "00060", "2014-01-01","2014-01-07") notActive <- readNWISdv(site, "00060", "2014-01-01","2014-01-07")
} }
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{renameNWISColumns}}, \code{\link{importWaterML1}} \code{\link{renameNWISColumns}}, \code{\link{importWaterML1}}
......
...@@ -67,6 +67,7 @@ is specified as FALSE. Sites with non-standard date formats (i.e. lacking a day) ...@@ -67,6 +67,7 @@ is specified as FALSE. Sites with non-standard date formats (i.e. lacking a day)
See \url{https://waterservices.usgs.gov/rest/GW-Levels-Service.html} for more information. See \url{https://waterservices.usgs.gov/rest/GW-Levels-Service.html} for more information.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
site_id <- "434400121275801" site_id <- "434400121275801"
\donttest{ \donttest{
data <- readNWISgwl(site_id) data <- readNWISgwl(site_id)
...@@ -79,6 +80,7 @@ data4 <- readNWISgwl("425957088141001", startDate = "1980-01-01") ...@@ -79,6 +80,7 @@ data4 <- readNWISgwl("425957088141001", startDate = "1980-01-01")
data5 <- readNWISgwl("263819081585801", parameterCd = "72019") data5 <- readNWISgwl("263819081585801", parameterCd = "72019")
} }
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{constructNWISURL}}, \code{\link{importRDB1}} \code{\link{constructNWISURL}}, \code{\link{importRDB1}}
......
...@@ -65,6 +65,7 @@ Reads surface-water measurement data from NWISweb. Data is retrieved from \url{h ...@@ -65,6 +65,7 @@ Reads surface-water measurement data from NWISweb. Data is retrieved from \url{h
See \url{https://waterdata.usgs.gov/usa/nwis/sw} for details about surface water. See \url{https://waterdata.usgs.gov/usa/nwis/sw} for details about surface water.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
site_ids <- c('01594440','040851325') site_ids <- c('01594440','040851325')
\donttest{ \donttest{
data <- readNWISmeas(site_ids) data <- readNWISmeas(site_ids)
...@@ -73,6 +74,7 @@ Meas05316840.ex <- readNWISmeas("05316840",expanded=TRUE) ...@@ -73,6 +74,7 @@ Meas05316840.ex <- readNWISmeas("05316840",expanded=TRUE)
Meas07227500.ex <- readNWISmeas("07227500",expanded=TRUE) Meas07227500.ex <- readNWISmeas("07227500",expanded=TRUE)
Meas07227500.exRaw <- readNWISmeas("07227500",expanded=TRUE, convertType = FALSE) Meas07227500.exRaw <- readNWISmeas("07227500",expanded=TRUE, convertType = FALSE)
} }
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{constructNWISURL}}, \code{\link{importRDB1}} \code{\link{constructNWISURL}}, \code{\link{importRDB1}}
......
...@@ -62,6 +62,7 @@ converting complete dates to a "Date" object, and converting incomplete dates to ...@@ -62,6 +62,7 @@ converting complete dates to a "Date" object, and converting incomplete dates to
needed, set the `asDateTime` argument to FALSE. No dates will be converted to R Date objects. needed, set the `asDateTime` argument to FALSE. No dates will be converted to R Date objects.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
site_ids <- c('01594440','040851325') site_ids <- c('01594440','040851325')
\donttest{ \donttest{
data <- readNWISpeak(site_ids) data <- readNWISpeak(site_ids)
...@@ -69,6 +70,7 @@ data2 <- readNWISpeak(site_ids, asDateTime=FALSE) ...@@ -69,6 +70,7 @@ data2 <- readNWISpeak(site_ids, asDateTime=FALSE)
stations<-c("06011000") stations<-c("06011000")
peakdata<-readNWISpeak(stations,convertType=FALSE) peakdata<-readNWISpeak(stations,convertType=FALSE)
} }
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{constructNWISURL}}, \code{\link{importRDB1}} \code{\link{constructNWISURL}}, \code{\link{importRDB1}}
......
...@@ -45,11 +45,13 @@ Not all active USGS streamgages have traditional rating curves that ...@@ -45,11 +45,13 @@ Not all active USGS streamgages have traditional rating curves that
relate flow to stage. relate flow to stage.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
site_id <- '01594440' site_id <- '01594440'
\donttest{ \donttest{
data <- readNWISrating(site_id, "base") data <- readNWISrating(site_id, "base")
attr(data, "RATING") attr(data, "RATING")
} }
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{constructNWISURL}}, \code{\link{importRDB1}} \code{\link{constructNWISURL}}, \code{\link{importRDB1}}
......
...@@ -69,12 +69,14 @@ comment \tab character \tab Header comments from the RDB file \cr ...@@ -69,12 +69,14 @@ comment \tab character \tab Header comments from the RDB file \cr
Imports data from USGS site file site. This function gets data from here: \url{https://waterservices.usgs.gov/} Imports data from USGS site file site. This function gets data from here: \url{https://waterservices.usgs.gov/}
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
\donttest{ \donttest{
siteINFO <- readNWISsite('05114000') siteINFO <- readNWISsite('05114000')
siteINFOMulti <- readNWISsite(c('05114000','09423350')) siteINFOMulti <- readNWISsite(c('05114000','09423350'))
} }
\dontshow{\}) # examplesIf}
} }
\keyword{USGS} \keyword{USGS}
\keyword{data} \keyword{data}
......
...@@ -59,6 +59,7 @@ Retrieves site statistics from the USGS Statistics Web Service beta. ...@@ -59,6 +59,7 @@ Retrieves site statistics from the USGS Statistics Web Service beta.
See \url{https://waterservices.usgs.gov/rest/Statistics-Service.html} for more information. See \url{https://waterservices.usgs.gov/rest/Statistics-Service.html} for more information.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
\donttest{ \donttest{
x1 <- readNWISstat(siteNumbers=c("02319394"), x1 <- readNWISstat(siteNumbers=c("02319394"),
parameterCd=c("00060"), parameterCd=c("00060"),
...@@ -77,6 +78,7 @@ x <- readNWISstat(siteNumbers=c("02171500"), ...@@ -77,6 +78,7 @@ x <- readNWISstat(siteNumbers=c("02171500"),
statType=c("mean","median"), statType=c("mean","median"),
startDate="2000",endDate="2010") startDate="2000",endDate="2010")
} }
\dontshow{\}) # examplesIf}
} }
\seealso{ \seealso{
\code{\link{constructNWISURL}}, \code{\link{importRDB1}} \code{\link{constructNWISURL}}, \code{\link{importRDB1}}
......
...@@ -43,6 +43,7 @@ Retrieves water use data from USGS Water Use Data for the Nation. See \url{http ...@@ -43,6 +43,7 @@ Retrieves water use data from USGS Water Use Data for the Nation. See \url{http
more information. All available use categories for the supplied arguments are retrieved. more information. All available use categories for the supplied arguments are retrieved.
} }
\examples{ \examples{
\dontshow{if (is_dataRetrieval_user()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
\donttest{ \donttest{
#All data for a county #All data for a county
allegheny <- readNWISuse(stateCd = "Pennsylvania",countyCd = "Allegheny") allegheny <- readNWISuse(stateCd = "Pennsylvania",countyCd = "Allegheny")
...@@ -65,4 +66,5 @@ paData <- readNWISuse(stateCd = "42",countyCd = c("Allegheny County", "BUTLER", ...@@ -65,4 +66,5 @@ paData <- readNWISuse(stateCd = "42",countyCd = c("Allegheny County", "BUTLER",
#retrieving two specific categories for an entire state #retrieving two specific categories for an entire state
ks <- readNWISuse(stateCd = "KS", countyCd = NULL, categories = c("IT","LI")) ks <- readNWISuse(stateCd = "KS", countyCd = NULL, categories = c("IT","LI"))
} }
\dontshow{\}) # examplesIf}
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment