diff --git a/.travis.yml b/.travis.yml index 8d6232076c5fe3d553587184c56bce8df8a7b4e9..fdaae1493532d93526f4585eea5f06820222dae1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,8 +15,7 @@ before_script: - curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh - chmod 755 ./travis-tool.sh - "./travis-tool.sh bootstrap" - - "./travis-tool.sh install_deps - ./travis-tool.sh install_r zoo XML RCurl dplyr reshape2 lubridate" - - "./travis-tool.sh install_github USGS-R/EGRET" + - "./travis-tool.sh install_deps - ./travis-tool.sh install_r XML RCurl plyr reshape2 lubridate httr" on_failure: - "./travis-tool.sh dump_logs" diff --git a/DESCRIPTION b/DESCRIPTION index 879edb2f6600721c6acf412ba7cfd3ac49f61726..d4561a216fc0ca8835e2a162ea820cc898b27aa1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: dataRetrieval Type: Package Title: Retrieval functions for USGS and EPA hydrologic and water quality data -Version: 1.5.0.9000 +Version: 2.0.0 Date: 2014-10-13 Authors@R: c( person("Robert", "Hirsch", role = c("aut"), email = "rhirsch@usgs.gov"), diff --git a/R/constructNWISURL.r b/R/constructNWISURL.r index 3658b869485411b6d892f33a34a0d14db9fc955b..99fdde9a58c7d1b19eb582b596b72dc33344748d 100644 --- a/R/constructNWISURL.r +++ b/R/constructNWISURL.r @@ -25,10 +25,10 @@ #' startDate <- '1985-01-01' #' endDate <- '' #' pCode <- c("00060","00010") -#' url_daily <- constructNWISURL(siteNumber,pCode, -#' startDate,endDate,'dv',statCd=c("00003","00001")) #' \dontrun{ #' # Not running for time considerations +#' url_daily <- constructNWISURL(siteNumber,pCode, +#' startDate,endDate,'dv',statCd=c("00003","00001")) #' url_unit <- constructNWISURL(siteNumber,pCode,"2012-06-28","2012-06-30",'iv') #' #' url_qw_single <- constructNWISURL(siteNumber,"01075",startDate,endDate,'qw') @@ -46,6 +46,8 @@ constructNWISURL <- function(siteNumber,parameterCd="00060",startDate="",endDate service <- match.arg(service, c("dv","uv","iv","qw","gwlevels","rating","peak","meas")) + parameterCdFile <- parameterCdFile + if(any(!is.na(parameterCd))){ pcodeCheck <- all(nchar(parameterCd) == 5) & all(!is.na(suppressWarnings(as.numeric(parameterCd)))) diff --git a/R/deprecatedFunctions.R b/R/deprecatedFunctions.R index d19c35b580fa280298023c295e94642e35142cba..61167e184649112c421d2bdd683c73a72b89c717 100644 --- a/R/deprecatedFunctions.R +++ b/R/deprecatedFunctions.R @@ -9,7 +9,7 @@ getNWISSites<- function(...){ #' @export getNWISDataAvailability <- function(siteNumbers,service=c("uv","dv","qw")){ message("This function is being deprecated. Please use whatNWISdata in the future.") - whatNWISdata(siteNumber=siteNumber, service=service) + whatNWISdata(siteNumbers, service=service) } @@ -52,7 +52,7 @@ getNWISdvData<- function(siteNumber,parameterCd,startDate="",endDate="",statCd=" #' @export getNWISunitData<- function(siteNumbers,parameterCd,startDate="",endDate="", tz=""){ message("This function is being deprecated. Please use readNWISuv in the future.") - readNWISuv(siteNumber,parameterCd,startDate,endDate, tz) + readNWISuv(siteNumbers,parameterCd,startDate,endDate, tz) } #' @rdname readNWISqw diff --git a/R/importRDB1.r b/R/importRDB1.r index 5ce9cd2566601f21ef99f3b2d8578bd6c25fd0bc..ce2627228d3147f6253007a15d96999783fde12a 100644 --- a/R/importRDB1.r +++ b/R/importRDB1.r @@ -23,6 +23,7 @@ #' endDate <- "2012-10-01" #' offering <- "00003" #' property <- "00060" +#' \dontrun{ #' obs_url <- constructNWISURL(siteNumber,property, #' startDate,endDate,"dv",format="tsv") #' data <- importRDB1(obs_url) @@ -46,6 +47,7 @@ #' fileName <- "RDB1Example.txt" #' fullPath <- file.path(filePath, fileName) #' importUserRDB <- importRDB1(fullPath) +#' } importRDB1 <- function(obs_url, asDateTime=FALSE, qw=FALSE, convertType = TRUE, tz=""){ if(tz != ""){ diff --git a/R/importWaterML1.r b/R/importWaterML1.r index 4e138253975a68bc05631cac999e55f72d7a55ae..972750d3fa4d896969518bf590eed0ffbfe866bb 100644 --- a/R/importWaterML1.r +++ b/R/importWaterML1.r @@ -21,6 +21,7 @@ #' offering <- '00003' #' property <- '00060' #' obs_url <- constructNWISURL(siteNumber,property,startDate,endDate,'dv') +#' \dontrun{ #' data <- importWaterML1(obs_url,TRUE) #' #' groundWaterSite <- "431049071324301" @@ -48,6 +49,7 @@ #' names(attributes(data)) #' attr(data, "url") #' attr(data, "disclaimer") +#' } importWaterML1 <- function(obs_url,asDateTime=FALSE, tz=""){ if(url.exists(obs_url)){ diff --git a/R/readNWISdata.r b/R/readNWISdata.r index 0a7e96a0553708545675c912daf957bb1166cfca..62587f4f20d8fa87f2e9254ac56289da1cb5eaac 100644 --- a/R/readNWISdata.r +++ b/R/readNWISdata.r @@ -10,12 +10,15 @@ #' @return retval dataframe #' @export #' @examples +#' \dontrun{ +#' # Examples not run for time considerations #' dataTemp <- readNWISdata(stateCd="OH",parameterCd="00010") #' dataTempUnit <- readNWISdata(sites="03086500", service="iv", parameterCd="00010") #' #Empty: #' multiSite <- readNWISdata(sites=c("04025000","04072150"), service="iv", parameterCd="00010") #' #Not empty: #' multiSite <- readNWISdata(sites=c("04025500","040263491"), service="iv", parameterCd="00060") +#' } readNWISdata <- function(service="dv", ...){ matchReturn <- list(...) diff --git a/R/readNWISqw.r b/R/readNWISqw.r index f35a567ad735d0c371a0b2dc487ab5049b61d70c..8aab12162ea045f89e556ea648b93f87f48f6c13 100644 --- a/R/readNWISqw.r +++ b/R/readNWISqw.r @@ -27,11 +27,13 @@ #' startDate <- '2010-01-01' #' endDate <- '' #' pCodes <- c('34247','30234','32104','34220') +#' \dontrun{ #' rawNWISqwData <- readNWISqw(siteNumber,pCodes,startDate,endDate) #' rawNWISqwDataExpandReshaped <- readNWISqw(siteNumber,pCodes, #' startDate,endDate,expanded=TRUE) #' rawNWISqwDataExpand <- readNWISqw(siteNumber,pCodes, #' startDate,endDate,expanded=TRUE,reshape=FALSE) +#' } readNWISqw <- function (siteNumber,pCodes,startDate="",endDate="", expanded=FALSE,reshape=TRUE,tz=""){ diff --git a/README.md b/README.md index 244ff694ec9653519b9b894fcee946492792e9e4..d986178a5a0b5a135c776d6fea04c383135963b8 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,11 @@ Windows: [ + + ## Function Overview Web service retrieval functions: @@ -59,32 +64,17 @@ To install the dataRetrieval package, you must be using R 3.0 or greater and run ##Version updates --------------- -###dataRetrieval 1.5.0 +###dataRetrieval 2.0.0 -* Changing naming convention one last time. Migrating `dataRetrieval` specific retrievals to `dataRetrieval`. +* Changing naming convention. Migrated `EGRET` specific retrievals to `EGRET` * Added back WaterML2 parsing tool * Added specific groundwater, rating, peak, and surfacewater measurement functions - +* Attached metadata attributes to returned dataframes ###dataRetrieval 1.4.0 -Changed naming convention: - -|Original Name | New Name | -| ------------- |:-------------| -|getDVData | getNWISDaily | -|getSampleData | getNWISSample | -|getSTORETData* | getWQPSample | -|getSampleDataFromFile | getUserSample | -|getDailyDataFromFile | getUserDaily | -|getMetaData | splits into getNWISInfo and getUserInfo | -|getSiteFileData | getNWISSiteInfo | -|getParameterInfo | getNWISPcodeInfo | -|getDataAvailability | getNWISDataAvailability | -|'retrieve' functions | 'get' | - -*Changed WaterML2 rbind fill from plyr function to dplyr. Removed plyr import, added dplyr. -*Removing WaterML2 until fixed. +* Changed naming convention: + ###dataRetrieval 1.3.3 diff --git a/inst/doc/dataRetrieval.R b/inst/doc/dataRetrieval.R index 34f5bfa8712569abd5a67710bb6ffceb5a792409..398063008852219f23f906b678a6d038d8a39944 100644 --- a/inst/doc/dataRetrieval.R +++ b/inst/doc/dataRetrieval.R @@ -206,10 +206,10 @@ dfLong <- readNWISqw(siteNumber, parameterCd, # startDate, endDate, expanded=TRUE, reshape=TRUE) -## ----qwmeta, echo=TRUE, eval=TRUE------------------------- - -comment(dfLong) - +## ----qwmeta, echo=TRUE, eval=FALSE------------------------ +# +# comment(dfLong) +# ## ----gwlexample, echo=TRUE, eval=TRUE--------------------- siteNumber <- "434400121275801" diff --git a/inst/doc/dataRetrieval.Rnw b/inst/doc/dataRetrieval.Rnw index fe19498fbf7f4831c25fb27dcaf1d6fd5c5f5079..9865c1a72c6dcc459849c7ca17379916b8376f2b 100644 --- a/inst/doc/dataRetrieval.Rnw +++ b/inst/doc/dataRetrieval.Rnw @@ -486,7 +486,7 @@ The column \texttt{"}datetime\texttt{"} in the returned dataframe is automatical \url{http://help.waterdata.usgs.gov/codes-and-parameters/daily-value-qualification-code-dv_rmk_cd} -Another example that doesn't use the defaults would be a request for mean and maximum daily temperature and discharge in early 2012: +Another example would be a request for mean and maximum daily temperature and discharge in early 2012: <<label=getNWIStemperature, echo=TRUE>>= @@ -605,7 +605,7 @@ dfLong <- readNWISqw(siteNumber, parameterCd, Metadata, such as information about the column names can be found by using the \texttt{comment} function, as described in section \ref{sec:metadata}. -<<qwmeta, echo=TRUE, eval=TRUE>>= +<<qwmeta, echo=TRUE, eval=FALSE>>= comment(dfLong) diff --git a/inst/doc/dataRetrieval.pdf b/inst/doc/dataRetrieval.pdf index 22acfbdd0c171d021dd47bf6340d2578560e7d63..36f7797774d27d37de5bd810a21dc82e05953425 100644 Binary files a/inst/doc/dataRetrieval.pdf and b/inst/doc/dataRetrieval.pdf differ diff --git a/man/constructNWISURL.Rd b/man/constructNWISURL.Rd index c62340a48e61709a45a2fad1c68ed34664d362ad..aa476f3a36533cd1cb4e9999b4503252696e35ee 100644 --- a/man/constructNWISURL.Rd +++ b/man/constructNWISURL.Rd @@ -42,10 +42,10 @@ siteNumber <- '01594440' startDate <- '1985-01-01' endDate <- '' pCode <- c("00060","00010") -url_daily <- constructNWISURL(siteNumber,pCode, - startDate,endDate,'dv',statCd=c("00003","00001")) \dontrun{ # Not running for time considerations +url_daily <- constructNWISURL(siteNumber,pCode, + startDate,endDate,'dv',statCd=c("00003","00001")) url_unit <- constructNWISURL(siteNumber,pCode,"2012-06-28","2012-06-30",'iv') url_qw_single <- constructNWISURL(siteNumber,"01075",startDate,endDate,'qw') diff --git a/man/dataRetrieval-package.Rd b/man/dataRetrieval-package.Rd new file mode 100644 index 0000000000000000000000000000000000000000..58cb8dc86251d3d1585d48ed6447c768abd8920d --- /dev/null +++ b/man/dataRetrieval-package.Rd @@ -0,0 +1,32 @@ +% Generated by roxygen2 (4.0.2): do not edit by hand +\docType{package} +\name{dataRetrieval-package} +\alias{dataRetrieval-package} +\title{Retrieval functions for USGS data} +\description{ +\tabular{ll}{ +Package: \tab dataRetrieval\cr +Type: \tab Package\cr +Version: \tab 1.5.0\cr +Date: \tab 2014-11-16\cr +License: \tab Unlimited for this package, dependencies have more restrictive licensing.\cr +Copyright: \tab This software is in the public domain because it contains materials +that originally came from the United States Geological Survey, an agency of +the United States Department of Interior. For more information, see the +official USGS copyright policy at +http://www.usgs.gov/visual-id/credit_usgs.html#copyright\cr +LazyLoad: \tab yes\cr +} +} +\details{ +Collection of functions to help retrieve USGS data from either web services or user provided data files. +} +\author{ +Robert M. Hirsch \email{rhirsch@usgs.gov}, Laura De Cicco \email{ldecicco@usgs.gov} +} +\references{ +Hirsch, R. M., Moyer, D. L. and Archfield, S. A. (2010), Weighted Regressions on Time, Discharge, and Season (WRTDS), with an Application to Chesapeake Bay River Inputs. JAWRA Journal of the American Water Resources Association, 46: 857-880. doi: 10.1111/j.1752-1688.2010.00482.x +} +\keyword{data,} +\keyword{retrieval} + diff --git a/man/importRDB1.Rd b/man/importRDB1.Rd index 0fcc978834df0b84e337edb8a2cd4f5c5a2b8d2b..44cdbc47b77f56cccc3d765b2b7c93a001246713 100644 --- a/man/importRDB1.Rd +++ b/man/importRDB1.Rd @@ -35,6 +35,7 @@ startDate <- "2012-09-01" endDate <- "2012-10-01" offering <- "00003" property <- "00060" +\dontrun{ obs_url <- constructNWISURL(siteNumber,property, startDate,endDate,"dv",format="tsv") data <- importRDB1(obs_url) @@ -59,4 +60,5 @@ fileName <- "RDB1Example.txt" fullPath <- file.path(filePath, fileName) importUserRDB <- importRDB1(fullPath) } +} diff --git a/man/importWaterML1.Rd b/man/importWaterML1.Rd index 9b80f695ec100c5da4195af618bc82f1c2b5f19f..ec3a0ba90e0ef83e67dcdd1f227b6b867a22f2c9 100644 --- a/man/importWaterML1.Rd +++ b/man/importWaterML1.Rd @@ -29,6 +29,7 @@ endDate <- "2012-10-01" offering <- '00003' property <- '00060' obs_url <- constructNWISURL(siteNumber,property,startDate,endDate,'dv') +\dontrun{ data <- importWaterML1(obs_url,TRUE) groundWaterSite <- "431049071324301" @@ -57,4 +58,5 @@ names(attributes(data)) attr(data, "url") attr(data, "disclaimer") } +} diff --git a/man/readNWISdata.Rd b/man/readNWISdata.Rd index 28aac9ce859cb35d76472beea60939dbbec53c54..2e4381e6981cdda66eb812e7db1e6c5b81bd73d5 100644 --- a/man/readNWISdata.Rd +++ b/man/readNWISdata.Rd @@ -22,6 +22,8 @@ Returns data from the NWIS web service. Arguments to the function should be based on \url{http://waterservices.usgs.gov} service calls. } \examples{ +\dontrun{ +# Examples not run for time considerations dataTemp <- readNWISdata(stateCd="OH",parameterCd="00010") dataTempUnit <- readNWISdata(sites="03086500", service="iv", parameterCd="00010") #Empty: @@ -29,6 +31,7 @@ multiSite <- readNWISdata(sites=c("04025000","04072150"), service="iv", paramete #Not empty: multiSite <- readNWISdata(sites=c("04025500","040263491"), service="iv", parameterCd="00060") } +} \keyword{NWIS} \keyword{data} \keyword{import} diff --git a/man/readNWISqw.Rd b/man/readNWISqw.Rd index 7cb0d4ac8ad5896dab697931561d36bdadbdb65a..e1c5a2576d086b243d1102c6e72d61f471938397 100644 --- a/man/readNWISqw.Rd +++ b/man/readNWISqw.Rd @@ -43,11 +43,13 @@ siteNumber <- c('04024430','04024000') startDate <- '2010-01-01' endDate <- '' pCodes <- c('34247','30234','32104','34220') +\dontrun{ rawNWISqwData <- readNWISqw(siteNumber,pCodes,startDate,endDate) rawNWISqwDataExpandReshaped <- readNWISqw(siteNumber,pCodes, startDate,endDate,expanded=TRUE) rawNWISqwDataExpand <- readNWISqw(siteNumber,pCodes, startDate,endDate,expanded=TRUE,reshape=FALSE) + } } \seealso{ \code{\link{readWQPdata}}, \code{\link{whatWQPsites}}, diff --git a/vignettes/dataRetrieval.Rnw b/vignettes/dataRetrieval.Rnw index fe19498fbf7f4831c25fb27dcaf1d6fd5c5f5079..9865c1a72c6dcc459849c7ca17379916b8376f2b 100644 --- a/vignettes/dataRetrieval.Rnw +++ b/vignettes/dataRetrieval.Rnw @@ -486,7 +486,7 @@ The column \texttt{"}datetime\texttt{"} in the returned dataframe is automatical \url{http://help.waterdata.usgs.gov/codes-and-parameters/daily-value-qualification-code-dv_rmk_cd} -Another example that doesn't use the defaults would be a request for mean and maximum daily temperature and discharge in early 2012: +Another example would be a request for mean and maximum daily temperature and discharge in early 2012: <<label=getNWIStemperature, echo=TRUE>>= @@ -605,7 +605,7 @@ dfLong <- readNWISqw(siteNumber, parameterCd, Metadata, such as information about the column names can be found by using the \texttt{comment} function, as described in section \ref{sec:metadata}. -<<qwmeta, echo=TRUE, eval=TRUE>>= +<<qwmeta, echo=TRUE, eval=FALSE>>= comment(dfLong) diff --git a/vignettes/figure/getNWIStemperaturePlot.pdf b/vignettes/figure/getNWIStemperaturePlot.pdf index 154a13b0b6cace0fa62ddeacecdcc7dace8e6187..d0c8c09d6c28b0d140421d163b5036c2a09c84ec 100644 Binary files a/vignettes/figure/getNWIStemperaturePlot.pdf and b/vignettes/figure/getNWIStemperaturePlot.pdf differ