Unverified Commit a363245b authored by Laura A DeCicco's avatar Laura A DeCicco Committed by GitHub
Browse files

Merge pull request #584 from dblodgett-usgs/master

quote handling -- fixes #583
parents 629d8295 a57a6d40
...@@ -23,7 +23,8 @@ find_good_names = function(input, type) { ...@@ -23,7 +23,8 @@ find_good_names = function(input, type) {
if (type == "nav") { if (type == "nav") {
grep("comid", names(input), value = TRUE) grep("comid", names(input), value = TRUE)
} else if (type == "feature") { } else if (type == "feature") {
c("sourceName", "identifier", "comid") c("sourceName", "identifier", "comid",
names(input)[names(input) %in% c("name", "reachcode", "measure")])
} else { } else {
NULL NULL
} }
......
...@@ -135,6 +135,7 @@ importRDB1 <- function(obs_url, asDateTime=TRUE, convertType = TRUE, tz="UTC"){ ...@@ -135,6 +135,7 @@ importRDB1 <- function(obs_url, asDateTime=TRUE, convertType = TRUE, tz="UTC"){
if(data.rows > 0){ if(data.rows > 0){
args_list <- list(file = f, args_list <- list(file = f,
delim = "\t", delim = "\t",
quote = "",
skip = meta.rows + 2, skip = meta.rows + 2,
col_names = FALSE) col_names = FALSE)
if(utils::packageVersion("readr") > 1.4){ if(utils::packageVersion("readr") > 1.4){
......
...@@ -44,6 +44,24 @@ test_that("External importRDB1 tests", { ...@@ -44,6 +44,24 @@ test_that("External importRDB1 tests", {
statCd = "laksjd") statCd = "laksjd")
# And....now there's data there: # And....now there's data there:
expect_null(importRDB1(url)) expect_null(importRDB1(url))
site <- "11486500"
url <- dataRetrieval:::drURL("site", arg.list = list(siteOutput = "Expanded",
format = "rdb",
site = site))
site_data <- importRDB1(url)
expect_equal(site_data$station_nm, "\"G\" CANAL NEAR OLENE,OREG.")
site <- "040854588204"
url <- dataRetrieval:::drURL("site", arg.list = list(siteOutput = "Expanded",
format = "rdb",
site = site))
site_data <- importRDB1(url)
expect_equal(site_data$station_nm, "\"FISHER CR AT 32 & HIGHLAND RD AT HOWARDS GROVE, W")
}) })
context("importRDB") context("importRDB")
......
...@@ -15,7 +15,8 @@ test_that("NLDI starting sources...", { ...@@ -15,7 +15,8 @@ test_that("NLDI starting sources...", {
# POINT GEOMETERY # POINT GEOMETERY
expect_equal(sum(names(findNLDI(nwis = '11120000')) == expect_equal(sum(names(findNLDI(nwis = '11120000')) ==
c('sourceName', 'identifier', "comid", c('sourceName', 'identifier', "comid",
"X", "Y", "geometry")), 6) "name", "reachcode", "measure",
"X", "Y", "geometry")), 9)
# COMID # COMID
expect_equal(findNLDI(comid = 101)$sourceName, "NHDPlus comid") expect_equal(findNLDI(comid = 101)$sourceName, "NHDPlus comid")
# NWIS # NWIS
......
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