From d64c783cee7ba3b31e4b69a7bca78d1b866b9b69 Mon Sep 17 00:00:00 2001 From: wdwatkins Date: Wed, 5 Apr 2017 09:44:39 -0500 Subject: [PATCH 1/2] removing messages --- R/getWebServiceData.R | 16 +--------------- R/importNGWMN_wml2.R | 4 ++-- R/readNGWMNdata.R | 4 ++-- man/readNGWMNdata.Rd | 4 ++-- tests/testthat/tests_imports.R | 4 ++-- 5 files changed, 9 insertions(+), 23 deletions(-) diff --git a/R/getWebServiceData.R b/R/getWebServiceData.R index c0b14002..eaf8c5c2 100644 --- a/R/getWebServiceData.R +++ b/R/getWebServiceData.R @@ -29,21 +29,7 @@ #' } getWebServiceData <- function(obs_url, ...){ - returnedList <- tryCatch({ - retryGetOrPost(obs_url, ...) - }, error = function(e){ - NULL - }) - - if(is.null(returnedList)){ - message("Switching from https to http") - obs_url <- gsub("https", "http", obs_url) - returnedList <- tryCatch({ - retryGetOrPost(obs_url, ...) - }, error = function(e){ - NULL - }) - } + returnedList <- retryGetOrPost(obs_url, ...) if(status_code(returnedList) != 200){ message("For: ", obs_url,"\n") diff --git a/R/importNGWMN_wml2.R b/R/importNGWMN_wml2.R index 08cbd798..d46a1437 100644 --- a/R/importNGWMN_wml2.R +++ b/R/importNGWMN_wml2.R @@ -84,7 +84,7 @@ importNGWMN <- function(input, asDateTime=FALSE, tz="UTC"){ } nonDateCols <- grep("date",names(mergedDF), value=TRUE, invert = TRUE) - if(length(mergedDF) > 0){ + if(nrow(mergedDF) > 0){ mergedDF[nonDateCols][mergedDF[nonDateCols] == "" | mergedDF[nonDateCols]== -999999.0] <- NA } attr(mergedDF, "gml:identifier") <- xml_text(xml_find_all(returnedDoc, ".//gml:identifier")) @@ -150,7 +150,7 @@ importWaterML2 <- function(input, asDateTime=FALSE, tz="UTC") { if(length(TVP) == 0) { #empty nodes on some sites return(data.frame(site = character(0), source = character(0), date = character(0), time = character(0), dateTime = character(0), value = numeric(0), - uom = character(0), comment = charater(0), stringsAsFactors = FALSE)) + uom = character(0), comment = character(0), stringsAsFactors = FALSE)) } rawTime <- xml_text(xml_find_all(TVP,".//wml2:time")) diff --git a/R/readNGWMNdata.R b/R/readNGWMNdata.R index ba636a7e..f63fd148 100644 --- a/R/readNGWMNdata.R +++ b/R/readNGWMNdata.R @@ -35,8 +35,8 @@ #' noDataSite <- readNGWMNdata(siteNumbers = noDataSite, service = "observation") #' #' #bounding box -#' bboxSites <- readNGWMNdata(service = "featureOfInterest", bbox = c(30, -99, 31, 102)) -#' #retrieve 100 sites. Set asDateTime to false since one site has an invalid date +#' bboxSites <- readNGWMNdata(service = "featureOfInterest", bbox = c(30, -102, 31, 99)) +#' #retrieve sites. Set asDateTime to false since one site has an invalid date #' bboxData <- readNGWMNdata(service = "observation", siteNumbers = bboxSites$site[1:3], #' asDateTime = FALSE) #' } diff --git a/man/readNGWMNdata.Rd b/man/readNGWMNdata.Rd index b7017292..2fa5d617 100644 --- a/man/readNGWMNdata.Rd +++ b/man/readNGWMNdata.Rd @@ -42,8 +42,8 @@ noDataSite <- "UTGS.401544112060301" noDataSite <- readNGWMNdata(siteNumbers = noDataSite, service = "observation") #bounding box -bboxSites <- readNGWMNdata(service = "featureOfInterest", bbox = c(30, -99, 31, 102)) -#retrieve 100 sites. Set asDateTime to false since one site has an invalid date +bboxSites <- readNGWMNdata(service = "featureOfInterest", bbox = c(30, -102, 31, 99)) +#retrieve sites. Set asDateTime to false since one site has an invalid date bboxData <- readNGWMNdata(service = "observation", siteNumbers = bboxSites$site[1:3], asDateTime = FALSE) } diff --git a/tests/testthat/tests_imports.R b/tests/testthat/tests_imports.R index 04a53582..4e1ec993 100644 --- a/tests/testthat/tests_imports.R +++ b/tests/testthat/tests_imports.R @@ -50,8 +50,8 @@ test_that("External importRDB1 tests", { site <- "05427850" url <- constructNWISURL(site,"00060","2015-01-01", "","dv",format="tsv") - expect_message(importRDB1(url)) - + urlData <- importRDB1(url) + expect_is(urlData, "data.frame") }) context("importRDB") From c66cf0a1f946550970fa807e490d99ed88e662f2 Mon Sep 17 00:00:00 2001 From: wdwatkins Date: Wed, 5 Apr 2017 09:44:49 -0500 Subject: [PATCH 2/2] version update --- DESCRIPTION | 4 ++-- NEWS | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 88aaa528..66d23c54 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: dataRetrieval Type: Package Title: Retrieval Functions for USGS and EPA Hydrologic and Water Quality Data -Version: 2.6.8 -Date: 2017-01-20 +Version: 2.6.8.1 +Date: 2017-04-05 Authors@R: c( person("Robert", "Hirsch", role = c("aut"), email = "rhirsch@usgs.gov"), person("Laura", "DeCicco", role = c("aut","cre"), diff --git a/NEWS b/NEWS index ace25b48..8c502354 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +dataRetrieval 2.6.8.1 +* Added National Groundwater Monitoring Network services, and new Water Quality Portal features. + dataRetrieval 2.6.3 ========== * All USGS web services are being flipped from http to https. This version of dataRetrieval will attempt to access https, if that fails, will attempt http.