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
3cef5eb3
Commit
3cef5eb3
authored
10 years ago
by
Laura A DeCicco
Browse files
Options
Downloads
Patches
Plain Diff
Changed type to service to be consistent.
parent
eb0e1dbb
No related branches found
No related tags found
1 merge request
!39
Overhaul of function names. Move some functionality to EGRET.
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
R/whatNWISData.r
+10
-6
10 additions, 6 deletions
R/whatNWISData.r
README.md
+8
-1
8 additions, 1 deletion
README.md
man/whatNWISData.Rd
+4
-4
4 additions, 4 deletions
man/whatNWISData.Rd
with
22 additions
and
11 deletions
R/whatNWISData.r
+
10
−
6
View file @
3cef5eb3
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#' Imports a table of available parameters, period of record, and count.
#' Imports a table of available parameters, period of record, and count.
#'
#'
#' @param siteNumber string USGS site number.
#' @param siteNumber string USGS site number.
#' @param
typ
e vector string. Options are "uv", "dv", "qw"
#' @param
servic
e vector string. Options are "uv", "dv", "qw"
#' @keywords data import USGS web service
#' @keywords data import USGS web service
#' @return retval dataframe with all information found in the expanded site file
#' @return retval dataframe with all information found in the expanded site file
#' @export
#' @export
...
@@ -11,9 +11,9 @@
...
@@ -11,9 +11,9 @@
#' @examples
#' @examples
#' availableData <- whatNWISData('05114000')
#' availableData <- whatNWISData('05114000')
#' # To find just unit value ('instantaneous') data:
#' # To find just unit value ('instantaneous') data:
#' uvData <- whatNWISData('05114000',
typ
e="uv")
#' uvData <- whatNWISData('05114000',
servic
e="uv")
#' uvDataMulti <- whatNWISData(c('05114000','09423350'),
typ
e="uv")
#' uvDataMulti <- whatNWISData(c('05114000','09423350'),
servic
e="uv")
whatNWISData
<-
function
(
siteNumber
,
typ
e
=
c
(
"uv"
,
"dv"
,
"qw"
)){
whatNWISData
<-
function
(
siteNumber
,
servic
e
=
c
(
"uv"
,
"dv"
,
"qw"
)){
siteNumber
<-
paste
(
siteNumber
,
collapse
=
","
)
siteNumber
<-
paste
(
siteNumber
,
collapse
=
","
)
...
@@ -45,7 +45,11 @@ whatNWISData <- function(siteNumber,type=c("uv","dv","qw")){
...
@@ -45,7 +45,11 @@ whatNWISData <- function(siteNumber,type=c("uv","dv","qw")){
SiteFile
<-
SiteFile
[
-1
,]
SiteFile
<-
SiteFile
[
-1
,]
SiteFile
<-
with
(
SiteFile
,
data.frame
(
site_no
=
site_no
,
parameter_cd
=
parm_cd
,
statCd
=
stat_cd
,
startDate
=
begin_date
,
endDate
=
end_date
,
count
=
count_nu
,
service
=
data_type_cd
,
stringsAsFactors
=
FALSE
))
SiteFile
<-
with
(
SiteFile
,
data.frame
(
site_no
=
site_no
,
parameter_cd
=
parm_cd
,
statCd
=
stat_cd
,
startDate
=
begin_date
,
endDate
=
end_date
,
count
=
count_nu
,
service
=
data_type_cd
,
stringsAsFactors
=
FALSE
))
SiteFile
<-
SiteFile
[
!
is.na
(
SiteFile
$
parameter_cd
),]
SiteFile
<-
SiteFile
[
!
is.na
(
SiteFile
$
parameter_cd
),]
SiteFile
<-
SiteFile
[
""
!=
SiteFile
$
parameter_cd
,]
SiteFile
<-
SiteFile
[
""
!=
SiteFile
$
parameter_cd
,]
...
@@ -59,7 +63,7 @@ whatNWISData <- function(siteNumber,type=c("uv","dv","qw")){
...
@@ -59,7 +63,7 @@ whatNWISData <- function(siteNumber,type=c("uv","dv","qw")){
pcodeINFO
<-
parameterCdFile
[
parameterCdFile
$
parameter_cd
%in%
pCodes
,]
pcodeINFO
<-
parameterCdFile
[
parameterCdFile
$
parameter_cd
%in%
pCodes
,]
SiteFile
<-
merge
(
SiteFile
,
pcodeINFO
,
by
=
"parameter_cd"
)
SiteFile
<-
merge
(
SiteFile
,
pcodeINFO
,
by
=
"parameter_cd"
)
SiteFile
<-
SiteFile
[
SiteFile
$
service
%in%
typ
e
,]
SiteFile
<-
SiteFile
[
SiteFile
$
service
%in%
servic
e
,]
return
(
SiteFile
)
return
(
SiteFile
)
}
else
{
}
else
{
message
(
paste
(
"URL caused an error:"
,
urlSitefile
))
message
(
paste
(
"URL caused an error:"
,
urlSitefile
))
...
...
This diff is collapsed.
Click to expand it.
README.md
+
8
−
1
View file @
3cef5eb3
...
@@ -14,7 +14,14 @@ Web service retrieval functions:
...
@@ -14,7 +14,14 @@ Web service retrieval functions:
|Function | Inputs | Description |
|Function | Inputs | Description |
| -------------| -------------|:-------------|
| -------------| -------------|:-------------|
|
`readNWISdata`
|
`...`
, service | NWIS data using user-specified queries |
|
`readNWISdata`
|
`...`
, service | NWIS data using user-specified queries |
|
`readNWISdv`
|
`Common 4`
, statCd | NWIS data with
`Common 4`
query |
|
`readNWISdv`
|
`Common 4`
, statCd | NWIS daily data with
`Common 4`
query |
|
`readNWISqw`
|
`Common 4`
, expanded | NWIS water quality data with
`Common 4`
query |
|
`readNWISunit`
|
`Common 4`
, statCd | NWIS instantaneous data with
`Common 4`
query |
|
`readNWISpCode`
| parameterCd | NWIS parameter code information |
|
`readNWISsite`
| siteNumber | NWIS site information |
|
`whatNWISsites`
|
`...`
| NWIS sites using user-specified queries |
|
`whatNWISdata`
| siteNumber, service | NWIS data availability, including period of record and count |
*
`Common 4`
= siteNumber, parameterCd, startDate, endDate
*
`Common 4`
= siteNumber, parameterCd, startDate, endDate
...
...
This diff is collapsed.
Click to expand it.
man/whatNWISData.Rd
+
4
−
4
View file @
3cef5eb3
...
@@ -3,12 +3,12 @@
...
@@ -3,12 +3,12 @@
\alias{whatNWISData}
\alias{whatNWISData}
\title{USGS data availability}
\title{USGS data availability}
\usage{
\usage{
whatNWISData(siteNumber,
typ
e = c("uv", "dv", "qw"))
whatNWISData(siteNumber,
servic
e = c("uv", "dv", "qw"))
}
}
\arguments{
\arguments{
\item{siteNumber}{string USGS site number.}
\item{siteNumber}{string USGS site number.}
\item{
typ
e}{vector string. Options are "uv", "dv", "qw"}
\item{
servic
e}{vector string. Options are "uv", "dv", "qw"}
}
}
\value{
\value{
retval dataframe with all information found in the expanded site file
retval dataframe with all information found in the expanded site file
...
@@ -19,8 +19,8 @@ Imports a table of available parameters, period of record, and count.
...
@@ -19,8 +19,8 @@ Imports a table of available parameters, period of record, and count.
\examples{
\examples{
availableData <- whatNWISData('05114000')
availableData <- whatNWISData('05114000')
# To find just unit value ('instantaneous') data:
# To find just unit value ('instantaneous') data:
uvData <- whatNWISData('05114000',
typ
e="uv")
uvData <- whatNWISData('05114000',
servic
e="uv")
uvDataMulti <- whatNWISData(c('05114000','09423350'),
typ
e="uv")
uvDataMulti <- whatNWISData(c('05114000','09423350'),
servic
e="uv")
}
}
\keyword{USGS}
\keyword{USGS}
\keyword{data}
\keyword{data}
...
...
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