Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dataRetrieval
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Water
dataRetrieval
Commits
9e8b5300
Commit
9e8b5300
authored
9 years ago
by
Laura A DeCicco
Browse files
Options
Downloads
Plain Diff
Merge pull request #148 from ldecicco-USGS/master
Make a consistent naming convention when dealing with reported columns.
parents
4047fb88
3886c7d2
No related branches found
Branches containing commit
Tags
v2.4.0
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
R/importRDB1.r
+4
-2
4 additions, 2 deletions
R/importRDB1.r
R/readNWISunit.r
+7
-4
7 additions, 4 deletions
R/readNWISunit.r
man/readNWISpeak.Rd
+3
-3
3 additions, 3 deletions
man/readNWISpeak.Rd
with
14 additions
and
9 deletions
R/importRDB1.r
+
4
−
2
View file @
9e8b5300
...
...
@@ -173,8 +173,10 @@ importRDB1 <- function(obs_url, asDateTime=FALSE, qw=FALSE, convertType = TRUE,
if
(
any
(
is.na
(
data
[,
regexpr
(
'd$'
,
dataType
)
>
0
]))){
data
[,
paste
(
names
(
data
)[
regexpr
(
'd$'
,
dataType
)
>
0
],
"date"
,
sep
=
"_"
)]
<-
as.Date
(
substr
(
rawDateTimes
,
1
,
10
))
data
[,
paste
(
names
(
data
)[
regexpr
(
'd$'
,
dataType
)
>
0
],
"tm"
,
sep
=
"_"
)]
<-
substr
(
rawDateTimes
,
12
,
nchar
(
rawDateTimes
))
base.name
<-
names
(
data
)[
regexpr
(
'd$'
,
dataType
)
>
0
]
base.name
<-
gsub
(
"_dt"
,
""
,
base.name
)
data
[,
paste
(
base.name
,
"date"
,
"reported"
,
sep
=
"_"
)]
<-
as.Date
(
substr
(
rawDateTimes
,
1
,
10
))
data
[,
paste
(
base.name
,
"tm"
,
"reported"
,
sep
=
"_"
)]
<-
substr
(
rawDateTimes
,
12
,
nchar
(
rawDateTimes
))
}
data
[,
regexpr
(
'd$'
,
dataType
)
>
0
]
<-
data
[,
regexpr
(
'd$'
,
dataType
)
>
0
]
+
offset
*
60
*
60
...
...
This diff is collapsed.
Click to expand it.
R/readNWISunit.r
+
7
−
4
View file @
9e8b5300
...
...
@@ -101,10 +101,10 @@ readNWISuv <- function (siteNumbers,parameterCd,startDate="",endDate="", tz=""){
#' peak_cd \tab character \tab Peak Discharge-Qualification codes (see \code{comment} for more information) \cr
#' gage_ht \tab numeric \tab Gage height for the associated peak streamflow in feet \cr
#' gage_ht_cd \tab character \tab Gage height qualification codes \cr
#' year_last_pk \tab
character
\tab Peak streamflow reported is the highest since this year \cr
#' ag_dt \tab
charac
te
r
\tab Date of maximum gage-height for water year (if not concurrent with peak) \cr
#' year_last_pk \tab
numeric
\tab Peak streamflow reported is the highest since this year \cr
#' ag_dt \tab
Da
te \tab Date of maximum gage-height for water year (if not concurrent with peak) \cr
#' ag_tm \tab character \tab Time of maximum gage-height for water year (if not concurrent with peak) \cr
#' ag_gage_ht \tab
character
\tab maximum Gage height for water year in feet (if not concurrent with peak) \cr
#' ag_gage_ht \tab
numeric
\tab maximum Gage height for water year in feet (if not concurrent with peak) \cr
#' ag_gage_ht_cd \tab character \tab maximum Gage height code \cr
#' }
#'
...
...
@@ -141,9 +141,12 @@ readNWISpeak <- function (siteNumbers,startDate="",endDate="", asDateTime=TRUE){
warning
(
length
(
badDates
),
" rows were thrown out due to incomplete dates"
)
}
}
data
$
peak_dt
<-
as.Date
(
data
$
peak_dt
)
if
(
"peak_dt"
%in%
names
(
data
))
data
$
peak_dt
<-
as.Date
(
data
$
peak_dt
,
format
=
"%Y-%m-%d"
)
if
(
"ag_dt"
%in%
names
(
data
))
data
$
ag_dt
<-
as.Date
(
data
$
ag_dt
,
format
=
"%Y-%m-%d"
)
}
data
$
gage_ht
<-
as.numeric
(
data
$
gage_ht
)
data
$
ag_gage_ht
<-
as.numeric
(
data
$
ag_gage_ht
)
data
$
year_last_pk
<-
as.numeric
(
data
$
year_last_pk
)
siteInfo
<-
readNWISsite
(
siteNumbers
)
siteInfo
<-
left_join
(
unique
(
data
[,
c
(
"agency_cd"
,
"site_no"
)]),
siteInfo
,
by
=
c
(
"agency_cd"
,
"site_no"
))
...
...
This diff is collapsed.
Click to expand it.
man/readNWISpeak.Rd
+
3
−
3
View file @
9e8b5300
...
...
@@ -30,10 +30,10 @@ peak_va \tab numeric \tab Annual peak streamflow value in cfs \cr
peak_cd \tab character \tab Peak Discharge-Qualification codes (see \code{comment} for more information) \cr
gage_ht \tab numeric \tab Gage height for the associated peak streamflow in feet \cr
gage_ht_cd \tab character \tab Gage height qualification codes \cr
year_last_pk \tab
character
\tab Peak streamflow reported is the highest since this year \cr
ag_dt \tab
charac
te
r
\tab Date of maximum gage-height for water year (if not concurrent with peak) \cr
year_last_pk \tab
numeric
\tab Peak streamflow reported is the highest since this year \cr
ag_dt \tab
Da
te \tab Date of maximum gage-height for water year (if not concurrent with peak) \cr
ag_tm \tab character \tab Time of maximum gage-height for water year (if not concurrent with peak) \cr
ag_gage_ht \tab
character
\tab maximum Gage height for water year in feet (if not concurrent with peak) \cr
ag_gage_ht \tab
numeric
\tab maximum Gage height for water year in feet (if not concurrent with peak) \cr
ag_gage_ht_cd \tab character \tab maximum Gage height code \cr
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment