From 96a51503a12868483b53b05842d03657e1585a47 Mon Sep 17 00:00:00 2001 From: Laura DeCicco <ldecicco@usgs.gov> Date: Thu, 31 Oct 2013 09:51:43 -0500 Subject: [PATCH] Added interaction option to retrieveNWIS functions. --- R/retrieveNWISData.r | 2 +- R/retrieveNWISqwData.r | 5 +++-- R/retrieveUnitNWISData.r | 2 +- man/retrieveNWISqwData.Rd | 6 +++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/R/retrieveNWISData.r b/R/retrieveNWISData.r index 2074576b..64a81074 100644 --- a/R/retrieveNWISData.r +++ b/R/retrieveNWISData.r @@ -28,7 +28,7 @@ #' rawDailyQAndTempMeanMax <- retrieveNWISData(siteNumber,c('00010','00060'), startDate, endDate, StatCd=c('00001','00003')) retrieveNWISData <- function (siteNumber,ParameterCd,StartDate,EndDate,StatCd="00003",format="tsv",interactive=TRUE){ - url <- constructNWISURL(siteNumber,ParameterCd,StartDate,EndDate,"dv",statCd=StatCd,format=format) + url <- constructNWISURL(siteNumber,ParameterCd,StartDate,EndDate,"dv",statCd=StatCd,format=format,interactive=interactive) if (format == "xml") { data <- getWaterML1Data(url) diff --git a/R/retrieveNWISqwData.r b/R/retrieveNWISqwData.r index 1e6b7ab5..a099157a 100644 --- a/R/retrieveNWISqwData.r +++ b/R/retrieveNWISqwData.r @@ -8,6 +8,7 @@ #' @param pCodes string or vector of USGS parameter code. This is usually an 5 digit number. #' @param startDate string starting date for data retrieval in the form YYYY-MM-DD. #' @param endDate string ending date for data retrieval in the form YYYY-MM-DD. +#' @param interactive logical Option for interactive mode. If true, there is user interaction for error handling and data checks. #' @keywords data import USGS web service #' @return data dataframe with agency, site, dateTime, value, and code columns #' @export @@ -23,9 +24,9 @@ #' data$dateTime <- as.Date(data$dateTime) #' compressedData <- compressData(data) #' Sample <- populateSampleColumns(compressedData) -retrieveNWISqwData <- function (siteNumber,pCodes,startDate,endDate){ +retrieveNWISqwData <- function (siteNumber,pCodes,startDate,endDate,interactive=TRUE){ - url <- constructNWISURL(siteNumber,pCodes,startDate,endDate,"qw") + url <- constructNWISURL(siteNumber,pCodes,startDate,endDate,"qw",interactive=interactive) tmp <- read.delim( url, diff --git a/R/retrieveUnitNWISData.r b/R/retrieveUnitNWISData.r index f2130d26..aa910267 100644 --- a/R/retrieveUnitNWISData.r +++ b/R/retrieveUnitNWISData.r @@ -25,7 +25,7 @@ #' rawData2 <- retrieveUnitNWISData(siteNumber,ParameterCd,StartDate,EndDate,"tsv") retrieveUnitNWISData <- function (siteNumber,ParameterCd,StartDate,EndDate,format="xml",interactive=TRUE){ - url <- constructNWISURL(siteNumber,ParameterCd,StartDate,EndDate,"uv",format=format) + url <- constructNWISURL(siteNumber,ParameterCd,StartDate,EndDate,"uv",format=format,interactive=interactive) if (format == "xml") { data <- getWaterML1Data(url) } else { diff --git a/man/retrieveNWISqwData.Rd b/man/retrieveNWISqwData.Rd index 48e5fd6e..40903e1e 100644 --- a/man/retrieveNWISqwData.Rd +++ b/man/retrieveNWISqwData.Rd @@ -3,7 +3,7 @@ \title{Raw Data Import for USGS NWIS QW Data} \usage{ retrieveNWISqwData(siteNumber, pCodes, startDate, - endDate) + endDate, interactive = TRUE) } \arguments{ \item{siteNumber}{string or vector of strings USGS site @@ -17,6 +17,10 @@ \item{endDate}{string ending date for data retrieval in the form YYYY-MM-DD.} + + \item{interactive}{logical Option for interactive mode. + If true, there is user interaction for error handling and + data checks.} } \value{ data dataframe with agency, site, dateTime, value, and -- GitLab