Skip to content
Snippets Groups Projects
readNWISuv.Rd 3.39 KiB
Newer Older
% Generated by roxygen2 (4.1.0): do not edit by hand
% Please edit documentation in R/readNWISunit.r
Laura A DeCicco's avatar
Laura A DeCicco committed
\name{readNWISuv}
Laura A DeCicco's avatar
Laura A DeCicco committed
\alias{readNWISuv}
\title{Instantaneous value data retrieval from USGS (NWIS)}
Laura A DeCicco's avatar
Laura A DeCicco committed
readNWISuv(siteNumbers, parameterCd, startDate = "", endDate = "",
  tz = "")
\item{siteNumbers}{character USGS site number (or multiple sites).  This is usually an 8 digit number}
\item{parameterCd}{character USGS parameter code.  This is usually an 5 digit number.}
\item{startDate}{character starting date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates
retrieval for the earliest possible record.}
\item{endDate}{character ending date for data retrieval in the form YYYY-MM-DD. Default is "" which indicates
retrieval for the latest possible record.}
Laura A DeCicco's avatar
Laura A DeCicco committed
\item{tz}{character to set timezone attribute of dateTime. Default is an empty quote, which converts the
dateTimes to UTC (properly accounting for daylight savings times based on the data's provided tz_cd column).
Laura A DeCicco's avatar
Laura A DeCicco committed
Possible values to provide are "America/New_York","America/Chicago", "America/Denver","America/Los_Angeles",
"America/Anchorage","America/Honolulu","America/Jamaica","America/Managua","America/Phoenix", and "America/Metlakatla"}
Laura A DeCicco's avatar
Laura A DeCicco committed
A data frame with the following columns:
\tabular{lll}{
Name \tab Type \tab Description \cr
Laura A DeCicco's avatar
Laura A DeCicco committed
agency_cd \tab character \tab The NWIS code for the agency reporting the data\cr
site_no \tab character \tab The USGS site number \cr
dateTime \tab POSIXct \tab The date and time of the value converted to UTC \cr
tz_cd \tab character \tab The time zone code for dateTime \cr
Laura A DeCicco's avatar
Laura A DeCicco committed
code \tab character \tab Any codes that qualify the corresponding value\cr
value \tab numeric \tab The numeric value for the parameter \cr
}
Laura A DeCicco's avatar
Laura A DeCicco committed
Note that code and value are repeated for the parameters requested. The names are of the form:
Laura A DeCicco's avatar
Laura A DeCicco committed
X_D_P_S, where X is literal,
D is an option description of the parameter,
P is the parameter code,
and S is the statistic code (if applicable).

There are also several useful attributes attached to the data frame:
\tabular{lll}{
Laura A DeCicco's avatar
Laura A DeCicco committed
Name \tab Type \tab Description \cr
url \tab character \tab The url used to generate the data \cr
siteInfo \tab data.frame \tab A data frame containing information on the requested sites \cr
variableInfo \tab data.frame \tab A data frame containing information on the requested parameters \cr
statisticInfo \tab data.frame \tab A data frame containing information on the requested statistics on the data \cr
queryTime \tab POSIXct \tab The time the data was returned \cr
}
Laura A DeCicco's avatar
Laura A DeCicco committed
Imports data from NWIS web service. This function gets the data from here: \url{http://waterservices.usgs.gov/}
A list of parameter codes can be found here: \url{http://nwis.waterdata.usgs.gov/nwis/pmcodes/}
A list of statistic codes can be found here: \url{http://nwis.waterdata.usgs.gov/nwis/help/?read_file=stat&format=table}.
More information on the web service can be found here: \url{http://waterservices.usgs.gov/rest/IV-Service.html}.
}
\examples{
siteNumber <- '05114000'
parameterCd <- '00060'
startDate <- "2014-10-10"
endDate <- "2014-10-10"
\dontrun{
rawData <- readNWISuv(siteNumber,parameterCd,startDate,endDate)

Laura A DeCicco's avatar
Laura A DeCicco committed
timeZoneChange <- readNWISuv(c('04024430','04024000'),parameterCd,
Laura A DeCicco's avatar
Laura A DeCicco committed
         "2013-11-03","2013-11-03")
Laura A DeCicco's avatar
Laura A DeCicco committed
\seealso{
\code{\link{renameNWISColumns}}, \code{\link{importWaterML1}}
}
\keyword{data}
\keyword{import}
\keyword{service}
\keyword{web}