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
d64c783c
Commit
d64c783c
authored
Apr 05, 2017
by
David Watkins
Browse files
removing messages
parent
2fde7567
Changes
5
Hide whitespace changes
Inline
Side-by-side
R/getWebServiceData.R
View file @
d64c783c
...
...
@@ -29,21 +29,7 @@
#' }
getWebServiceData
<-
function
(
obs_url
,
...
){
returnedList
<-
tryCatch
({
retryGetOrPost
(
obs_url
,
...
)
},
error
=
function
(
e
){
NULL
})
if
(
is.null
(
returnedList
)){
message
(
"Switching from https to http"
)
obs_url
<-
gsub
(
"https"
,
"http"
,
obs_url
)
returnedList
<-
tryCatch
({
retryGetOrPost
(
obs_url
,
...
)
},
error
=
function
(
e
){
NULL
})
}
returnedList
<-
retryGetOrPost
(
obs_url
,
...
)
if
(
status_code
(
returnedList
)
!=
200
){
message
(
"For: "
,
obs_url
,
"\n"
)
...
...
R/importNGWMN_wml2.R
View file @
d64c783c
...
...
@@ -84,7 +84,7 @@ importNGWMN <- function(input, asDateTime=FALSE, tz="UTC"){
}
nonDateCols
<-
grep
(
"date"
,
names
(
mergedDF
),
value
=
TRUE
,
invert
=
TRUE
)
if
(
length
(
mergedDF
)
>
0
){
if
(
nrow
(
mergedDF
)
>
0
){
mergedDF
[
nonDateCols
][
mergedDF
[
nonDateCols
]
==
""
|
mergedDF
[
nonDateCols
]
==
-999999.0
]
<-
NA
}
attr
(
mergedDF
,
"gml:identifier"
)
<-
xml_text
(
xml_find_all
(
returnedDoc
,
".//gml:identifier"
))
...
...
@@ -150,7 +150,7 @@ importWaterML2 <- function(input, asDateTime=FALSE, tz="UTC") {
if
(
length
(
TVP
)
==
0
)
{
#empty nodes on some sites
return
(
data.frame
(
site
=
character
(
0
),
source
=
character
(
0
),
date
=
character
(
0
),
time
=
character
(
0
),
dateTime
=
character
(
0
),
value
=
numeric
(
0
),
uom
=
character
(
0
),
comment
=
charater
(
0
),
stringsAsFactors
=
FALSE
))
uom
=
character
(
0
),
comment
=
chara
c
ter
(
0
),
stringsAsFactors
=
FALSE
))
}
rawTime
<-
xml_text
(
xml_find_all
(
TVP
,
".//wml2:time"
))
...
...
R/readNGWMNdata.R
View file @
d64c783c
...
...
@@ -35,8 +35,8 @@
#' noDataSite <- readNGWMNdata(siteNumbers = noDataSite, service = "observation")
#'
#' #bounding box
#' bboxSites <- readNGWMNdata(service = "featureOfInterest", bbox = c(30, -
99
, 31,
102
))
#' #retrieve
100
sites. Set asDateTime to false since one site has an invalid date
#' bboxSites <- readNGWMNdata(service = "featureOfInterest", bbox = c(30, -
102
, 31,
99
))
#' #retrieve sites. Set asDateTime to false since one site has an invalid date
#' bboxData <- readNGWMNdata(service = "observation", siteNumbers = bboxSites$site[1:3],
#' asDateTime = FALSE)
#' }
...
...
man/readNGWMNdata.Rd
View file @
d64c783c
...
...
@@ -42,8 +42,8 @@ noDataSite <- "UTGS.401544112060301"
noDataSite <- readNGWMNdata(siteNumbers = noDataSite, service = "observation")
#bounding box
bboxSites <- readNGWMNdata(service = "featureOfInterest", bbox = c(30, -
99
, 31,
102
))
#retrieve
100
sites. Set asDateTime to false since one site has an invalid date
bboxSites <- readNGWMNdata(service = "featureOfInterest", bbox = c(30, -
102
, 31,
99
))
#retrieve sites. Set asDateTime to false since one site has an invalid date
bboxData <- readNGWMNdata(service = "observation", siteNumbers = bboxSites$site[1:3],
asDateTime = FALSE)
}
...
...
tests/testthat/tests_imports.R
View file @
d64c783c
...
...
@@ -50,8 +50,8 @@ test_that("External importRDB1 tests", {
site
<-
"05427850"
url
<-
constructNWISURL
(
site
,
"00060"
,
"2015-01-01"
,
""
,
"dv"
,
format
=
"tsv"
)
expect_message
(
importRDB1
(
url
)
)
urlData
<-
importRDB1
(
url
)
expect_is
(
urlData
,
"data.frame"
)
})
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