Skip to content
Snippets Groups Projects
Commit 3cef5eb3 authored by Laura A DeCicco's avatar Laura A DeCicco
Browse files

Changed type to service to be consistent.

parent eb0e1dbb
No related branches found
No related tags found
1 merge request!39Overhaul of function names. Move some functionality to EGRET.
......@@ -3,7 +3,7 @@
#' Imports a table of available parameters, period of record, and count.
#'
#' @param siteNumber string USGS site number.
#' @param type vector string. Options are "uv", "dv", "qw"
#' @param service vector string. Options are "uv", "dv", "qw"
#' @keywords data import USGS web service
#' @return retval dataframe with all information found in the expanded site file
#' @export
......@@ -11,9 +11,9 @@
#' @examples
#' availableData <- whatNWISData('05114000')
#' # To find just unit value ('instantaneous') data:
#' uvData <- whatNWISData('05114000',type="uv")
#' uvDataMulti <- whatNWISData(c('05114000','09423350'),type="uv")
whatNWISData <- function(siteNumber,type=c("uv","dv","qw")){
#' uvData <- whatNWISData('05114000',service="uv")
#' uvDataMulti <- whatNWISData(c('05114000','09423350'),service="uv")
whatNWISData <- function(siteNumber,service=c("uv","dv","qw")){
siteNumber <- paste(siteNumber,collapse=",")
......@@ -45,7 +45,11 @@ whatNWISData <- function(siteNumber,type=c("uv","dv","qw")){
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["" != SiteFile$parameter_cd,]
......@@ -59,7 +63,7 @@ whatNWISData <- function(siteNumber,type=c("uv","dv","qw")){
pcodeINFO <- parameterCdFile[parameterCdFile$parameter_cd %in% pCodes,]
SiteFile <- merge(SiteFile,pcodeINFO,by="parameter_cd")
SiteFile <- SiteFile[SiteFile$service %in% type,]
SiteFile <- SiteFile[SiteFile$service %in% service,]
return(SiteFile)
} else {
message(paste("URL caused an error:", urlSitefile))
......
......@@ -14,7 +14,14 @@ Web service retrieval functions:
|Function | Inputs | Description |
| -------------| -------------|:-------------|
|`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
......
......@@ -3,12 +3,12 @@
\alias{whatNWISData}
\title{USGS data availability}
\usage{
whatNWISData(siteNumber, type = c("uv", "dv", "qw"))
whatNWISData(siteNumber, service = c("uv", "dv", "qw"))
}
\arguments{
\item{siteNumber}{string USGS site number.}
\item{type}{vector string. Options are "uv", "dv", "qw"}
\item{service}{vector string. Options are "uv", "dv", "qw"}
}
\value{
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.
\examples{
availableData <- whatNWISData('05114000')
# To find just unit value ('instantaneous') data:
uvData <- whatNWISData('05114000',type="uv")
uvDataMulti <- whatNWISData(c('05114000','09423350'),type="uv")
uvData <- whatNWISData('05114000',service="uv")
uvDataMulti <- whatNWISData(c('05114000','09423350'),service="uv")
}
\keyword{USGS}
\keyword{data}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment