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
f175f829
Commit
f175f829
authored
Mar 27, 2017
by
David Watkins
Browse files
fix for site with empty timeseries
parent
4513780d
Changes
1
Hide whitespace changes
Inline
Side-by-side
R/importNGWMN_wml2.R
View file @
f175f829
...
...
@@ -84,7 +84,9 @@ importNGWMN <- function(input, asDateTime=FALSE, tz="UTC"){
}
nonDateCols
<-
grep
(
"date"
,
names
(
mergedDF
),
value
=
TRUE
,
invert
=
TRUE
)
mergedDF
[
nonDateCols
][
mergedDF
[
nonDateCols
]
==
""
|
mergedDF
[
nonDateCols
]
==
-999999.0
]
<-
NA
if
(
length
(
mergedDF
)
>
0
){
mergedDF
[
nonDateCols
][
mergedDF
[
nonDateCols
]
==
""
|
mergedDF
[
nonDateCols
]
==
-999999.0
]
<-
NA
}
attr
(
mergedDF
,
"gml:identifier"
)
<-
xml_text
(
xml_find_all
(
returnedDoc
,
".//gml:identifier"
))
attr
(
mergedDF
,
"generationDate"
)
<-
xml_text
(
xml_find_all
(
returnedDoc
,
".//wml2:generationDate"
))
meta
<-
xml_find_all
(
returnedDoc
,
".//gmd:contact"
)
...
...
@@ -146,6 +148,9 @@ importWaterML2 <- function(input, asDateTime=FALSE, tz="UTC") {
gmlID
<-
xml_attr
(
returnedDoc
,
"id"
)
#TODO: make this an attribute
TVP
<-
xml_find_all
(
returnedDoc
,
".//wml2:MeasurementTVP"
)
#time-value pairs
if
(
length
(
TVP
)
==
0
)
{
#empty nodes on some sites
return
(
data.frame
())
}
rawTime
<-
xml_text
(
xml_find_all
(
TVP
,
".//wml2:time"
))
valueNodes
<-
xml_find_all
(
TVP
,
".//wml2:value"
)
...
...
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