Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Water
dataRetrieval
Commits
a363245b
Unverified
Commit
a363245b
authored
Nov 01, 2021
by
Laura A DeCicco
Committed by
GitHub
Nov 01, 2021
Browse files
Merge pull request #584 from dblodgett-usgs/master
quote handling -- fixes #583
parents
629d8295
a57a6d40
Changes
4
Show whitespace changes
Inline
Side-by-side
R/findNLDI.R
View file @
a363245b
...
...
@@ -23,7 +23,8 @@ find_good_names = function(input, type) {
if
(
type
==
"nav"
)
{
grep
(
"comid"
,
names
(
input
),
value
=
TRUE
)
}
else
if
(
type
==
"feature"
)
{
c
(
"sourceName"
,
"identifier"
,
"comid"
)
c
(
"sourceName"
,
"identifier"
,
"comid"
,
names
(
input
)[
names
(
input
)
%in%
c
(
"name"
,
"reachcode"
,
"measure"
)])
}
else
{
NULL
}
...
...
R/importRDB1.r
View file @
a363245b
...
...
@@ -135,6 +135,7 @@ importRDB1 <- function(obs_url, asDateTime=TRUE, convertType = TRUE, tz="UTC"){
if
(
data.rows
>
0
){
args_list
<-
list
(
file
=
f
,
delim
=
"\t"
,
quote
=
""
,
skip
=
meta.rows
+
2
,
col_names
=
FALSE
)
if
(
utils
::
packageVersion
(
"readr"
)
>
1.4
){
...
...
tests/testthat/tests_imports.R
View file @
a363245b
...
...
@@ -44,6 +44,24 @@ test_that("External importRDB1 tests", {
statCd
=
"laksjd"
)
# And....now there's data there:
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"
)
...
...
tests/testthat/tests_nldi.R
View file @
a363245b
...
...
@@ -15,7 +15,8 @@ test_that("NLDI starting sources...", {
# POINT GEOMETERY
expect_equal
(
sum
(
names
(
findNLDI
(
nwis
=
'11120000'
))
==
c
(
'sourceName'
,
'identifier'
,
"comid"
,
"X"
,
"Y"
,
"geometry"
)),
6
)
"name"
,
"reachcode"
,
"measure"
,
"X"
,
"Y"
,
"geometry"
)),
9
)
# COMID
expect_equal
(
findNLDI
(
comid
=
101
)
$
sourceName
,
"NHDPlus comid"
)
# NWIS
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment