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
920c988b
Commit
920c988b
authored
Sep 09, 2021
by
Laura A DeCicco
Browse files
Reprercussions of not stopping
parent
ad557e7b
Changes
7
Hide whitespace changes
Inline
Side-by-side
R/importNGWMN_wml2.R
View file @
920c988b
...
...
@@ -44,7 +44,9 @@ importNGWMN <- function(input, asDateTime=FALSE, tz="UTC"){
raw
<-
TRUE
}
else
{
returnedDoc
<-
getWebServiceData
(
input
,
encoding
=
'gzip'
)
if
(
is.null
(
returnedDoc
)){
return
(
invisible
(
NULL
))
}
returnedDoc
<-
xml_root
(
returnedDoc
)
}
...
...
R/importRDB1.r
View file @
920c988b
...
...
@@ -103,6 +103,9 @@ importRDB1 <- function(obs_url, asDateTime=TRUE, convertType = TRUE, tz="UTC"){
doc
<-
getWebServiceData
(
obs_url
,
httr
::
write_disk
(
f
),
encoding
=
'gzip'
)
if
(
is.null
(
doc
)){
return
(
invisible
(
NULL
))
}
if
(
"warn"
%in%
names
(
attr
(
doc
,
"headerInfo"
))){
data
<-
data.frame
()
attr
(
data
,
"headerInfo"
)
<-
attr
(
doc
,
"headerInfo"
)
...
...
R/importWQP.R
View file @
920c988b
...
...
@@ -52,6 +52,9 @@ importWQP <- function(obs_url, zip=TRUE, tz="UTC",
doc
<-
getWebServiceData
(
obs_url
,
httr
::
write_disk
(
temp
),
httr
::
accept
(
"application/zip"
))
if
(
is.null
(
doc
)){
return
(
invisible
(
NULL
))
}
headerInfo
<-
httr
::
headers
(
doc
)
doc
<-
utils
::
unzip
(
temp
,
exdir
=
tempdir
())
unlink
(
temp
)
...
...
@@ -59,6 +62,9 @@ importWQP <- function(obs_url, zip=TRUE, tz="UTC",
}
else
{
doc
<-
getWebServiceData
(
obs_url
,
httr
::
accept
(
"text/tsv"
))
if
(
is.null
(
doc
)){
return
(
invisible
(
NULL
))
}
headerInfo
<-
attr
(
doc
,
"headerInfo"
)
}
...
...
R/importWaterML1.r
View file @
920c988b
...
...
@@ -413,7 +413,12 @@ check_if_xml <- function(obs_url){
}
else
if
(
inherits
(
obs_url
,
c
(
"xml_node"
,
"xml_nodeset"
)))
{
returnedDoc
<-
obs_url
}
else
{
returnedDoc
<-
xml_root
(
getWebServiceData
(
obs_url
,
encoding
=
'gzip'
))
doc
<-
getWebServiceData
(
obs_url
,
encoding
=
'gzip'
)
if
(
is.null
(
doc
)){
return
(
invisible
(
NULL
))
}
returnedDoc
<-
xml_root
(
doc
)
}
return
(
returnedDoc
)
}
\ No newline at end of file
R/whatNWISsites.R
View file @
920c988b
...
...
@@ -45,7 +45,9 @@ whatNWISsites <- function(...){
urlCall
<-
drURL
(
'site'
,
Access
=
pkg.env
$
access
,
arg.list
=
values
)
rawData
<-
getWebServiceData
(
urlCall
,
encoding
=
'gzip'
)
if
(
is.null
(
rawData
)){
return
(
invisible
(
NULL
))
}
doc
<-
xml_root
(
rawData
)
siteCategories
<-
xml_children
(
doc
)
retVal
<-
NULL
...
...
R/whatWQPdata.R
View file @
920c988b
...
...
@@ -161,6 +161,9 @@ whatWQPdata <- function(..., saveFile = tempfile()){
}
doc
<-
getWebServiceData
(
baseURL
,
httr
::
write_disk
(
saveFile_zip
))
if
(
is.null
(
doc
)){
return
(
invisible
(
NULL
))
}
headerInfo
<-
attr
(
doc
,
"headerInfo"
)
if
(
headerInfo
$
`total-site-count`
==
0
){
...
...
tests/testthat/tests_imports.R
View file @
920c988b
...
...
@@ -43,7 +43,7 @@ test_that("External importRDB1 tests", {
format
=
"tsv"
,
statCd
=
"laksjd"
)
# And....now there's data there:
expect_
error
(
importRDB1
(
url
))
expect_
null
(
importRDB1
(
url
))
})
context
(
"importRDB"
)
...
...
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