Maintenance scheduled for Thursday, January 27th at 15:00 MST. Expected downtime <1 hour.

Commit 3aee6ad6 authored by Laura A DeCicco's avatar Laura A DeCicco Committed by GitHub
Browse files

Merge pull request #253 from wdwatkins/master

fixed additional importWaterML2 bugs, added tests
parents 0a926575 53c60e8b
......@@ -53,7 +53,7 @@ importWaterML2 <- function(obs_url, asDateTime=FALSE, tz=""){
rawData <- obs_url
doc <- xmlTreeParse(rawData, getDTD = FALSE, useInternalNodes = TRUE)
} else {
doc <- xmlTreeParse(getWebServiceData(obs_url), getDTD = FALSE, useInternalNodes = TRUE)
doc <- xmlTreeParse(obs_url, getDTD = FALSE, useInternalNodes = TRUE)
}
if(tz != ""){
......@@ -137,6 +137,11 @@ importWaterML2 <- function(obs_url, asDateTime=FALSE, tz=""){
namespaces = chunkNS))
DF2$qualifier <- ifelse(defaultQualifier != isQual,isQual,defaultQualifier)
DF2$`swe:value` <- NULL
} else if (length(defaultQualifier > 1)){
for (j in 1:length(defaultQualifier)){
qualName <- paste0("qualifier",j)
DF2[,eval(qualName)] <- defaultQualifier[j]
}
} else {
DF2$qualifier <- rep(defaultQualifier,nrow(DF2))
}
......
......@@ -119,6 +119,25 @@ test_that("External importWaterML1 test", {
})
context("importWaterML2")
test_that("importWaterML2 internal test", {
filePath <- system.file("extdata", package="dataRetrieval")
fileName <- "WaterML2Example.xml"
fullPath <- file.path(filePath, fileName)
UserData <- importWaterML2(fullPath)
expect_is(UserData$value, 'numeric')
expect_is(UserData$qualifier, 'character')
test_that("importWaterML2 external test", {
testthat::skip_on_cran()
url <- "http://waterservices.usgs.gov/nwis/iv/?format=waterml,2.0&sites=01646500&parameterCd=00060,00065"
data <- importWaterML2(url)
expect_is(data$value, 'numeric')
expect_gt(nrow(data),0)
})
})
context("importWQP_noCRAN")
test_that("External WQP tests", {
......
Markdown is supported
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