Newer
Older
% Generated by roxygen2 (4.0.2): do not edit by hand
Laura A DeCicco
committed
\name{constructNWISURL}
\alias{constructNWISURL}
\title{Construct NWIS url for data retrieval}
\usage{
constructNWISURL(siteNumber, parameterCd, startDate, endDate, service,
statCd = "00003", format = "xml", expanded = FALSE,
interactive = TRUE)
Laura A DeCicco
committed
}
\arguments{
\item{siteNumber}{string or vector of strings USGS site number. This is usually an 8 digit number}
Laura A DeCicco
committed
\item{parameterCd}{string or vector of USGS parameter code. This is usually an 5 digit number.}
Laura A DeCicco
committed
\item{startDate}{string starting date for data retrieval in the form YYYY-MM-DD.}
Laura A DeCicco
committed
\item{endDate}{string ending date for data retrieval in the form YYYY-MM-DD.}
Laura A DeCicco
committed
\item{service}{string USGS service to call. Possible values are "dv" (daily values), "uv" (unit/instantaneous values), "qw" (water quality data), and "wqp" (water quality portal, which can include STORET).}
\item{statCd}{string or vector USGS statistic code only used for daily value service. This is usually 5 digits. Daily mean (00003) is the default.}
\item{format}{string, can be "tsv" or "xml", and is only applicable for daily and unit value requests. "tsv" returns results faster, but there is a possiblitiy that an incomplete file is returned without warning. XML is slower,
but will offer a warning if the file was incomplete (for example, if there was a momentary problem with the internet connection). It is possible to safely use the "tsv" option,
but the user must carefully check the results to see if the data returns matches what is expected. The default is therefore "xml".}
\item{expanded}{logical defaults to FALSE. If TRUE, retrieves additional information, only applicable for qw data.}
\item{interactive}{logical Option for interactive mode. If TRUE, there is user interaction for error handling and data checks.}
Laura A DeCicco
committed
}
\value{
Laura A DeCicco
committed
}
\description{
Imports data from NWIS web service. This function gets the data from here: \url{http://nwis.waterdata.usgs.gov/nwis/qwdata}
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}
Laura A DeCicco
committed
}
\examples{
siteNumber <- '01594440'
startDate <- '1985-01-01'
endDate <- ''
Laura A DeCicco
committed
pCode <- c("00060","00010")
url_daily <- constructNWISURL(siteNumber,pCode,
startDate,endDate,'dv',statCd=c("00003","00001"))
url_unit <- constructNWISURL(siteNumber,pCode,"2012-06-28","2012-06-30",'iv')
url_qw_single <- constructNWISURL(siteNumber,"01075",startDate,endDate,'qw')
url_qw <- constructNWISURL(siteNumber,c('01075','00029','00453'),
startDate,endDate,'qw')
url_wqp <- constructNWISURL(paste("USGS",siteNumber,sep="-"),c('01075','00029','00453'),
startDate,endDate,'wqp')
url_daily_tsv <- constructNWISURL(siteNumber,pCode,startDate,endDate,'dv',
statCd=c("00003","00001"),format="tsv")
Laura A DeCicco
committed
}
\keyword{USGS}
Laura A DeCicco
committed
\keyword{data}
\keyword{import}
\keyword{service}
\keyword{web}