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

Fixed siteInfo call for multiple pcodes.

parent 2270f927
No related branches found
No related tags found
1 merge request!51Fixed multi-pcode WQP call bug.
...@@ -17,6 +17,15 @@ ...@@ -17,6 +17,15 @@
#' @keywords data import USGS web service #' @keywords data import USGS web service
#' @return retval dataframe raw data returned from the Water Quality Portal. Additionally, a POSIXct dateTime column is supplied for #' @return retval dataframe raw data returned from the Water Quality Portal. Additionally, a POSIXct dateTime column is supplied for
#' start and end times. #' start and end times.
#'
#' There are also several useful attributes attached to the data frame:
#' \tabular{lll}{
#' 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
#' queryTime \tab POSIXct \tab The time the data was returned \cr
#' }
#' @export #' @export
#' @import RCurl #' @import RCurl
#' @seealso \code{\link{readWQPdata}}, \code{\link{whatWQPsites}}, #' @seealso \code{\link{readWQPdata}}, \code{\link{whatWQPsites}},
...@@ -25,7 +34,8 @@ ...@@ -25,7 +34,8 @@
#' \dontrun{ #' \dontrun{
#' rawPcode <- readWQPqw('USGS-01594440','01075', '', '') #' rawPcode <- readWQPqw('USGS-01594440','01075', '', '')
#' rawCharacteristicName <- readWQPqw('WIDNR_WQX-10032762','Specific conductance', '', '') #' rawCharacteristicName <- readWQPqw('WIDNR_WQX-10032762','Specific conductance', '', '')
#' rawPHmultiSite <- readWQPqw(c('USGS-05406450', 'USGS-05427949','WIDNR_WQX-133040'), 'pH','','') #' rawPHsites <- readWQPqw(c('USGS-05406450', 'USGS-05427949','WIDNR_WQX-133040'), 'pH','','')
#' nwisEx <- readWQPqw('USGS-04024000',c('34247','30234','32104','34220'),'','')
#' } #' }
readWQPqw <- function(siteNumbers,parameterCd,startDate="",endDate=""){ readWQPqw <- function(siteNumbers,parameterCd,startDate="",endDate=""){
...@@ -43,11 +53,11 @@ readWQPqw <- function(siteNumbers,parameterCd,startDate="",endDate=""){ ...@@ -43,11 +53,11 @@ readWQPqw <- function(siteNumbers,parameterCd,startDate="",endDate=""){
} }
if(pcodeCheck){ if(pcodeCheck){
siteInfo <- whatWQPsites(siteid=paste0(siteNumbers,";"), siteInfo <- whatWQPsites(siteid=paste0(siteNumbers,collapse=";"),
pCode=parameterCd, startDateLo=startDate, startDateHi=endDate) pCode=paste0(parameterCd,collapse=";"), startDateLo=startDate, startDateHi=endDate)
} else { } else {
siteInfo <- whatWQPsites(siteid=paste0(siteNumbers,";"), siteInfo <- whatWQPsites(siteid=paste0(siteNumbers,collapse=";"),
characteristicName=parameterCd, startDateLo=startDate, startDateHi=endDate) characteristicName=paste0(parameterCd,collapse=";"), startDateLo=startDate, startDateHi=endDate)
} }
siteInfoCommon <- data.frame(station_nm=siteInfo$MonitoringLocationName, siteInfoCommon <- data.frame(station_nm=siteInfo$MonitoringLocationName,
......
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