Skip to content
Snippets Groups Projects
Commit 51acbf75 authored by Laura A DeCicco's avatar Laura A DeCicco
Browse files

Fixes #143

parent 838cef4f
No related branches found
No related tags found
1 merge request!144Better encoding and starting switch to dplyr
......@@ -244,8 +244,8 @@ constructWQPURL <- function(siteNumber,parameterCd,startDate,endDate){
suppressWarnings(pCodeLogic <- all(!is.na(as.numeric(parameterCd))))
} else {
pCodeLogic <- FALSE
parameterCd <- gsub(",","%2C",parameterCd)
parameterCd <- URLencode(parameterCd)
# parameterCd <- gsub(",","%2C",parameterCd)
parameterCd <- URLencode(parameterCd, reserved = TRUE)
}
if(multiplePcodes){
......
......@@ -106,7 +106,7 @@ importWQP <- function(obs_url, zip=FALSE, tz=""){
suppressWarnings(retval <- read.delim(if(zip) doc else textConnection(doc), header = TRUE, quote="",
dec=".", sep='\t', colClasses=as.character(classColumns)))
unlink(doc)
if(zip) unlink(doc)
numToBeReturned <- as.numeric(headerInfo["Total-Result-Count"])
......
......@@ -93,8 +93,8 @@
#' startDate <- as.Date("2013-01-01")
#' nutrientDaneCounty <- readWQPdata(countycode="US:55:025",startDate=startDate,
#' characteristicType="Nutrient")
#' nutrientDaneCounty <- readWQPdata(countycode="US:55:025",startDate="",
#' characteristicType="Nutrient")
#'
#'
#' }
readWQPdata <- function(...){
......@@ -142,8 +142,8 @@ readWQPdata <- function(...){
tz <- ""
}
values <- gsub("%20","+",values)
values <- sapply(values, function(x) URLencode(x, reserved = TRUE))
urlCall <- paste(paste(names(values),values,sep="="),collapse="&")
baseURL <- "http://www.waterqualitydata.us/Result/search?"
......
......@@ -55,6 +55,7 @@
#'
#' type <- "Stream"
#' sites <- whatWQPsites(countycode="US:55:025",siteType=type)
#' data <- whatWQPsites(siteType = "Lake, Reservoir, Impoundment", statecode = "US:55")
#' }
whatWQPsites <- function(...){
......@@ -80,14 +81,14 @@ whatWQPsites <- function(...){
}
names(values)[names(values) == "stateCd"] <- "statecode"
}
values <- gsub("%20","+",values)
if("bBox" %in% names(values)){
values['bBox'] <- gsub(pattern = ";", replacement = ",", x = values['bBox'])
}
values <- checkWQPdates(values)
values <- sapply(values, function(x) URLencode(x, reserved = TRUE))
urlCall <- paste(paste(names(values),values,sep="="),collapse="&")
......
......@@ -102,8 +102,8 @@ pHDataExpanded2 <- readWQPdata(bBox=c(-90.10,42.67,-88.64,43.35),characteristicN
startDate <- as.Date("2013-01-01")
nutrientDaneCounty <- readWQPdata(countycode="US:55:025",startDate=startDate,
characteristicType="Nutrient")
nutrientDaneCounty <- readWQPdata(countycode="US:55:025",startDate="",
characteristicType="Nutrient")
}
}
\keyword{WQP}
......
......@@ -62,6 +62,7 @@ site1 <- whatWQPsites(siteid="USGS-01594440")
type <- "Stream"
sites <- whatWQPsites(countycode="US:55:025",siteType=type)
data <- whatWQPsites(siteType = "Lake, Reservoir, Impoundment", statecode = "US:55")
}
}
\keyword{WQP}
......
......@@ -37,13 +37,12 @@ test_that("General WQP retrievals working", {
pHData <- readWQPdata(siteid="USGS-04024315",characteristicName=nameToUse)
expect_is(pHData$ActivityStartDateTime, 'POSIXct')
# pHDataExpanded2 <- readWQPdata(bBox=c(-90.1,42.9,-89.9,43.1),
# characteristicName=nameToUse)
# expect_is(pHDataExpanded2$ActivityStartDateTime, 'POSIXct')
pHDataExpanded2 <- readWQPdata(bBox=c(-90.1,42.9,-89.9,43.1),
characteristicName=nameToUse)
expect_is(pHDataExpanded2$ActivityStartDateTime, 'POSIXct')
startDate <- as.Date("2013-01-01")
nutrientDaneCounty <- readWQPdata(countycode="US:55:025",startDate=startDate,
characteristicType="Nutrient")
expect_is(nutrientDaneCounty$ActivityStartDateTime, 'POSIXct')
expect_that(1==1, is_true())
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment