From 7c9ad570981cf6795d2ae8db6dd33209b10d4fd1 Mon Sep 17 00:00:00 2001 From: Laura DeCicco <ldecicco@usgs.gov> Date: Wed, 13 Mar 2013 13:56:28 -0500 Subject: [PATCH] Performed build with new getDataAvailablity function. --- DESCRIPTION | 2 +- NAMESPACE | 1 + R/getDataAvailability.r | 12 ++++++------ man/constructNWISURL.Rd | 3 +-- man/getDataAvailablilty.Rd | 40 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 man/getDataAvailablilty.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 417f6ce7..3156758c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -51,7 +51,7 @@ Collate: 'retrieveNWISqwData.r' 'processQWData.r' 'constructNWISURL.r' - 'getSiteFileData.r' + 'getDataAvailability.r' Depends: R (>= 2.15.0) Imports: diff --git a/NAMESPACE b/NAMESPACE index df03fab0..e3a7026e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -7,6 +7,7 @@ export(formatCheckDate) export(formatCheckParameterCd) export(formatCheckSiteNumber) export(getDailyDataFromFile) +export(getDataAvailablilty) export(getDataFromFile) export(getDVData) export(getMetaData) diff --git a/R/getDataAvailability.r b/R/getDataAvailability.r index 2d8927b0..1ab606ca 100644 --- a/R/getDataAvailability.r +++ b/R/getDataAvailability.r @@ -1,22 +1,22 @@ #' USGS data availability #' -#' Imports a table of available parameters, period of record, and count. +#' Imports a table of available parameters, period of record, and count. There is also an option to load the long parameter names and additional information on the parameters with longNames=TRUE. #' #' @param siteNumber string USGS site number. This is usually an 8 digit number #' @param interactive logical Option for interactive mode. If true, there is user interaction for error handling and data checks. -#' @param longNames logical +#' @param longNames logical indicates whether or not to make a web call to get long names of parameters. Be aware this could take a very long time if the station has lots of data. #' @keywords data import USGS web service #' @return retval dataframe with all information found in the expanded site file #' @export #' @examples #' # These examples require an internet connection to run -#' siteINFO <- getSiteFileData('05114000',interactive=FALSE) -getSiteFileData <- function(siteNumber="",interactive=TRUE){ +#' availableData <- getDataAvailablilty('05114000',interactive=FALSE) +getDataAvailablilty <- function(siteNumber="",interactive=TRUE, longNames=FALSE){ # Checking for 8 digit site ID: - siteNumber <- formatCheckSiteNumber(siteNumber, longNames = FALSE,interactive=interactive) + siteNumber <- formatCheckSiteNumber(siteNumber,interactive=interactive) - urlSitefile <- paste("http://waterservices.usgs.gov/nwis/site?format=rdb&siteOutput=Expanded&sites=",siteNumber,sep = "") + urlSitefile <- paste("http://waterservices.usgs.gov/nwis/site?format=rdb&seriesCatalogOutput=true&sites=",siteNumber,sep = "") SiteFile <- read.delim( urlSitefile, diff --git a/man/constructNWISURL.Rd b/man/constructNWISURL.Rd index 0f3cb8e5..813f2cf3 100644 --- a/man/constructNWISURL.Rd +++ b/man/constructNWISURL.Rd @@ -28,8 +28,7 @@ quality portal, which can include STORET).} } \value{ - data dataframe with agency, site, dateTime, value, and - code columns + url string } \description{ Imports data from NWIS web service. This function gets diff --git a/man/getDataAvailablilty.Rd b/man/getDataAvailablilty.Rd new file mode 100644 index 00000000..750535bc --- /dev/null +++ b/man/getDataAvailablilty.Rd @@ -0,0 +1,40 @@ +\name{getDataAvailablilty} +\alias{getDataAvailablilty} +\title{USGS data availability} +\usage{ + getDataAvailablilty(siteNumber = "", interactive = TRUE, + longNames = FALSE) +} +\arguments{ + \item{siteNumber}{string USGS site number. This is + usually an 8 digit number} + + \item{interactive}{logical Option for interactive mode. + If true, there is user interaction for error handling and + data checks.} + + \item{longNames}{logical indicates whether or not to make + a web call to get long names of parameters. Be aware this + could take a very long time if the station has lots of + data.} +} +\value{ + retval dataframe with all information found in the + expanded site file +} +\description{ + Imports a table of available parameters, period of + record, and count. There is also an option to load the + long parameter names and additional information on the + parameters with longNames=TRUE. +} +\examples{ +# These examples require an internet connection to run +availableData <- getDataAvailablilty('05114000',interactive=FALSE) +} +\keyword{data} +\keyword{import} +\keyword{service} +\keyword{USGS} +\keyword{web} + -- GitLab