Commit ccd734ae authored by Laura A DeCicco's avatar Laura A DeCicco
Browse files

Merge pull request #129 from ldecicco-USGS/master

gwlevels to rdb
parents 070b7124 cfda1678
Package: dataRetrieval
Type: Package
Title: Retrieval Functions for USGS and EPA Hydrologic and Water Quality Data
Version: 2.2.3
Version: 2.3.0
Date: 2015-06-29
Authors@R: c( person("Robert", "Hirsch", role = c("aut"),
email = "rhirsch@usgs.gov"),
......
dataRetrieval 2.3.0
===========
* Converted all Water Quality Portal queries to sorted=no to greatly improve retrieval times
* Converted gwlevels in readNWISdata to rdb
dataRetrieval 2.2.0
===========
* Changed the output of tz_cd (in all *NWIS functions) to the timezone that is reported in the data frame. Before this version, it was the time zone reported by NWIS. This was confusing however since the dateTime columns default to UTC.
......
......@@ -75,6 +75,7 @@
#' "drain_area_va","obs_count_nu"),service="qw")
#' temp <- readNWISdata(bBox=c(-83,36.5,-81,38.5), parameterCd="00010", service="site",
#' seriesCatalogOutput=TRUE)
#' wiGWL <- readNWISdata(stateCd="WI",service="gwlevels")
#' }
readNWISdata <- function(service="dv", ...){
......@@ -153,7 +154,7 @@ readNWISdata <- function(service="dv", ...){
tz <- ""
}
if(service == "site"){
if(service %in% c("site","gwlevels")){
format <- "rdb"
}
......@@ -162,14 +163,15 @@ readNWISdata <- function(service="dv", ...){
baseURL <- paste0(baseURL,service,"/?format=",format,"&")
urlCall <- paste0(baseURL,urlCall)
if(service == "site"){
if(format == "rdb"){
possibleError <- tryCatch({
retval <- importRDB1(urlCall, asDateTime = FALSE, qw = FALSE, tz = tz)
retval <- importRDB1(urlCall, asDateTime = (service == "qwdata"),
qw = (service == "qwdata"), tz = tz)
}, error = function(e) {
stop(e, "with url:", urlCall)
})
} else if (service != "qwdata") {
} else {
possibleError <- tryCatch({
retval <- importWaterML1(urlCall, asDateTime = ("iv" == service), tz= tz)
}, error = function(e) {
......@@ -202,12 +204,6 @@ readNWISdata <- function(service="dv", ...){
}
}
} else {
possibleError <- tryCatch({
retval <- importRDB1(urlCall, asDateTime = TRUE, qw = TRUE)
}, error = function(e) {
stop(e, "with url:", urlCall)
})
}
return(retval)
......
......@@ -129,7 +129,7 @@ readWQPqw <- function(siteNumbers,parameterCd,startDate="",endDate="",tz=""){
startDateLo=startDate, startDateHi=endDate)
} else {
siteInfo <- whatWQPsites(siteid=paste0(siteNumbers,collapse=";"),
characteristicName=paste0(parameterCd,collapse=";"),
characteristicName=URLencode(paste0(parameterCd,collapse=";")),
startDateLo=startDate, startDateHi=endDate)
}
......
......@@ -82,6 +82,7 @@ qwData <- readNWISdata(bBox=c(-82.5,41.52,-81,41),startDate=as.Date("2000-01-01"
"drain_area_va","obs_count_nu"),service="qw")
temp <- readNWISdata(bBox=c(-83,36.5,-81,38.5), parameterCd="00010", service="site",
seriesCatalogOutput=TRUE)
wiGWL <- readNWISdata(stateCd="WI",service="gwlevels")
}
}
\seealso{
......
......@@ -113,5 +113,15 @@ test_that("NWIS dv tests", {
expect_that(nrow(notActive) == 0, is_true())
})
test_that("WQP qw tests", {
testthat::skip_on_cran()
nameToUse <- 'Specific conductance'
pcodeToUse <- '00095'
INFO_WQP <- readWQPqw('USGS-04024315',pcodeToUse, startDate = "", endDate = "")
expect_is(INFO_WQP$ActivityStartDateTime, 'POSIXct')
INFO2 <- readWQPqw('WIDNR_WQX-10032762',nameToUse, startDate = "", endDate = "")
expect_is(INFO2$ActivityStartDateTime, 'POSIXct')
})
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