Skip to content
Snippets Groups Projects
Commit 9345a0db authored by Read, Jordan S.'s avatar Read, Jordan S.
Browse files

straw dog for access pattern

parent 9e8b5300
No related branches found
No related tags found
1 merge request!149straw dog for access pattern
...@@ -24,6 +24,7 @@ export(readNWISuv) ...@@ -24,6 +24,7 @@ export(readNWISuv)
export(readWQPdata) export(readWQPdata)
export(readWQPqw) export(readWQPqw)
export(renameNWISColumns) export(renameNWISColumns)
export(setAccess)
export(stateCd) export(stateCd)
export(stateCdLookup) export(stateCdLookup)
export(whatNWISdata) export(whatNWISdata)
......
pkg.env <- new.env()
.onLoad = function(libname, pkgname){
setAccess('public')
}
\ No newline at end of file
#'Set data endpoint
#'
#'access Indicate which dataRetrieval access code
#' you want to use options: \code{c('public','internal')}
#'
#' @param access code for data access. Either "public" or "internal"
#'
#'@author Luke Winslow, Jordan S Read
#'
#'@examples
#'
#'\dontrun{
#'setAccess('internal')
#'
#'setAccess('public')
#'
#'}
#'
#' @export
setAccess = function(access="public"){
access = match.arg(access, c('public','internal'))
if(access=="internal"){
access.param = '?Access=3'
message('setting access to internal')
}else {
access.param = '?Access=1'
}
pkg.env$waterservices = paste0("http://waterservices.usgs.gov/nwis/site/", access.param)
}
drURL = function(base.name, params){
return(paste0(pkg.env[[base.name]], params))
}
\ No newline at end of file
...@@ -40,7 +40,7 @@ whatNWISsites <- function(...){ ...@@ -40,7 +40,7 @@ whatNWISsites <- function(...){
names(values)[names(values) == "siteNumber"] <- "sites" names(values)[names(values) == "siteNumber"] <- "sites"
names(values)[names(values) == "siteNumbers"] <- "sites" names(values)[names(values) == "siteNumbers"] <- "sites"
baseURL <- "http://waterservices.usgs.gov/nwis/site/?format=mapper&" baseURL <- drURL('waterservices',"&format=mapper&")
urlCall <- paste(baseURL, urlCall <- paste(baseURL,
urlCall,sep = "") urlCall,sep = "")
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/setAccess.R
\name{setAccess}
\alias{setAccess}
\title{Set data endpoint}
\usage{
setAccess(access = "public")
}
\arguments{
\item{access}{code for data access. Either "public" or "internal"}
}
\description{
access Indicate which dataRetrieval access code
you want to use options: \code{c('public','internal')}
}
\examples{
\dontrun{
setAccess('internal')
setAccess('public')
}
}
\author{
Luke Winslow, Jordan S Read
}
% Generated by roxygen2: do not edit by hand % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/whatNWISdata.r % Please edit documentation in R/whatNWISData.r
\name{whatNWISdata} \name{whatNWISdata}
\alias{whatNWISdata} \alias{whatNWISdata}
\title{USGS data availability} \title{USGS data availability}
......
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