From 2f9c4ff594e6405d0226c8030d126bf76a4ff8bb Mon Sep 17 00:00:00 2001 From: Laura DeCicco <ldecicco@usgs.gov> Date: Mon, 8 Apr 2013 17:06:05 -0500 Subject: [PATCH] Updated help files. --- man/constructNWISURL.Rd | 30 +++++++++++++++++++++--------- man/getRDB1Data.Rd | 35 +++++++++++++++++++++++++++++++++++ man/retrieveNWISData.Rd | 17 +++++++++++++++-- man/retrieveUnitNWISData.Rd | 16 ++++++++++++++-- 4 files changed, 85 insertions(+), 13 deletions(-) create mode 100644 man/getRDB1Data.Rd diff --git a/man/constructNWISURL.Rd b/man/constructNWISURL.Rd index 1cd8ce48..33fd4f50 100644 --- a/man/constructNWISURL.Rd +++ b/man/constructNWISURL.Rd @@ -3,7 +3,7 @@ \title{Construct NWIS url for data retrieval} \usage{ constructNWISURL(siteNumber, parameterCd, startDate, - endDate, service, statCd = "00003", + endDate, service, statCd = "00003", format = "xml", interactive = FALSE) } \arguments{ @@ -28,6 +28,17 @@ values), "qw" (water quality data), and "wqp" (water quality portal, which can include STORET).} + \item{format}{string, can be "tsv" or "xml", and is only + applicable for daily and unit value requests. "tsv" + returns results faster, but there is a possiblitiy that + an incomplete file is returned without warning. XML is + slower, but will offer a warning if the file was + incomplete (for example, if there was a momentary problem + with the internet connection). It is possible to safely + use the "tsv" option, but the user must carefully check + the results to see if the data returns matches what is + expected. The default is therefore "xml".} + \item{interactive}{logical Option for interactive mode. If true, there is user interaction for error handling and data checks.} @@ -45,19 +56,20 @@ \url{http://nwis.waterdata.usgs.gov/nwis/help/?read_file=stat&format=table} } \examples{ -siteNumber <- '04085427' -startDate <- '2012-01-01' -endDate <- '2012-06-30' +siteNumber <- '01594440' +startDate <- '1985-01-01' +endDate <- '' pCode <- c("00060","00010") url_daily <- constructNWISURL(siteNumber,pCode,startDate,endDate,'dv',statCd=c("00003","00001")) -url_unit <- constructNWISURL(siteNumber,pCode,startDate,endDate,'iv') -url_qw_single <- constructNWISURL(siteNumber,"34220",startDate,endDate,'qwdata') -url_qw <- constructNWISURL(siteNumber,c('34247','30234','32104','34220'),startDate,endDate,'qwdata') -url_wqp <- constructNWISURL(siteNumber,"34220",startDate,endDate,'wqp') +url_unit <- constructNWISURL(siteNumber,pCode,"2012-06-28","2012-06-30",'iv') +url_qw_single <- constructNWISURL(siteNumber,"01075",startDate,endDate,'qw') +url_qw <- constructNWISURL(siteNumber,c('01075','00029','00453'),startDate,endDate,'qw') +url_wqp <- constructNWISURL(siteNumber,c('01075','00029','00453'),startDate,endDate,'wqp') +url_daily_tsv <- constructNWISURL(siteNumber,pCode,startDate,endDate,'dv',statCd=c("00003","00001"),format="tsv") } -\keyword{USGS} \keyword{data} \keyword{import} \keyword{service} +\keyword{USGS} \keyword{web} diff --git a/man/getRDB1Data.Rd b/man/getRDB1Data.Rd new file mode 100644 index 00000000..6777c95a --- /dev/null +++ b/man/getRDB1Data.Rd @@ -0,0 +1,35 @@ +\name{getRDB1Data} +\alias{getRDB1Data} +\title{Function to return data from the NWIS RDB 1.0 format} +\usage{ + getRDB1Data(obs_url, asDateTime = FALSE) +} +\arguments{ + \item{obs_url}{string containing the url for the + retrieval} + + \item{asDateTime}{logical, if TRUE returns date and time + as POSIXct, if FALSE, Date} +} +\value{ + data a data frame containing columns agency, site, + dateTime, values, and remark codes for all requested + combinations +} +\description{ + This function accepts a url parameter that already + contains the desired NWIS site, parameter code, + statistic, startdate and enddate. +} +\examples{ +sites <- "02177000" +startDate <- "2012-09-01" +endDate <- "2012-10-01" +offering <- '00003' +property <- '00060' +obs_url <- constructNWISURL(sites,property,startDate,endDate,'dv',format='tsv') +data <- getRDB1Data(obs_url) +urlMulti <- constructNWISURL("04085427",c("00060","00010"),startDate,endDate,'dv',statCd=c("00003","00001"),'tsv') +multiData <- getRDB1Data(urlMulti) +} + diff --git a/man/retrieveNWISData.Rd b/man/retrieveNWISData.Rd index 7260b72e..32ba4c39 100644 --- a/man/retrieveNWISData.Rd +++ b/man/retrieveNWISData.Rd @@ -3,7 +3,8 @@ \title{Raw Data Import for USGS NWIS Data} \usage{ retrieveNWISData(siteNumber, ParameterCd, StartDate, - EndDate, StatCd = "00003", interactive = TRUE) + EndDate, StatCd = "00003", format = "xml", + interactive = TRUE) } \arguments{ \item{siteNumber}{string USGS site number. This is @@ -21,6 +22,17 @@ \item{StatCd}{string USGS statistic code. This is usually 5 digits. Daily mean (00003) is the default.} + \item{format}{string, can be "tsv" or "xml", and is only + applicable for daily and unit value requests. "tsv" + returns results faster, but there is a possiblitiy that + an incomplete file is returned without warning. XML is + slower, but will offer a warning if the file was + incomplete (for example, if there was a momentary problem + with the internet connection). It is possible to safely + use the "tsv" option, but the user must carefully check + the results to see if the data returns matches what is + expected. The default is therefore "xml".} + \item{interactive}{logical Option for interactive mode. If true, there is user interaction for error handling and data checks.} @@ -45,11 +57,12 @@ endDate <- '2012-06-30' pCode <- "00060" rawDailyQ <- retrieveNWISData(siteNumber,pCode, startDate, endDate) rawDailyTemperature <- retrieveNWISData(siteNumber,'00010', startDate, endDate, StatCd='00001',interactive=FALSE) +rawDailyTemperatureTSV <- retrieveNWISData(siteNumber,'00010', startDate, endDate, StatCd='00001',format="tsv",interactive=FALSE) rawDailyQAndTempMeanMax <- retrieveNWISData(siteNumber,c('00010','00060'), startDate, endDate, StatCd=c('00001','00003'), interactive=FALSE) } -\keyword{USGS} \keyword{data} \keyword{import} \keyword{service} +\keyword{USGS} \keyword{web} diff --git a/man/retrieveUnitNWISData.Rd b/man/retrieveUnitNWISData.Rd index 4622f8dd..5109fd5c 100644 --- a/man/retrieveUnitNWISData.Rd +++ b/man/retrieveUnitNWISData.Rd @@ -3,7 +3,7 @@ \title{Raw Data Import for Instantaneous USGS NWIS Data} \usage{ retrieveUnitNWISData(siteNumber, ParameterCd, StartDate, - EndDate, interactive = TRUE) + EndDate, format = "xml", interactive = TRUE) } \arguments{ \item{siteNumber}{string USGS site number. This is @@ -21,6 +21,17 @@ \item{interactive}{logical Option for interactive mode. If true, there is user interaction for error handling and data checks.} + + \item{format}{string, can be "tsv" or "xml", and is only + applicable for daily and unit value requests. "tsv" + returns results faster, but there is a possiblitiy that + an incomplete file is returned without warning. XML is + slower, but will offer a warning if the file was + incomplete (for example, if there was a momentary problem + with the internet connection). It is possible to safely + use the "tsv" option, but the user must carefully check + the results to see if the data returns matches what is + expected. The default is therefore "xml".} } \value{ data dataframe with agency, site, dateTime, time zone, @@ -41,10 +52,11 @@ StartDate <- as.character(Sys.Date()) EndDate <- as.character(Sys.Date()) # These examples require an internet connection to run rawData <- retrieveUnitNWISData(siteNumber,ParameterCd,StartDate,EndDate,interactive=FALSE) +rawData2 <- retrieveUnitNWISData(siteNumber,ParameterCd,StartDate,EndDate,"tsv",interactive=FALSE) } -\keyword{USGS} \keyword{data} \keyword{import} \keyword{service} +\keyword{USGS} \keyword{web} -- GitLab