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

Added tz argument to WQP.

parent 2b8d1af9
No related branches found
No related tags found
1 merge request!117More tz and state code updates.
......@@ -117,15 +117,22 @@ importWQP <- function(obs_url, zip=FALSE, tz=""){
retval$ActivityStartDateTime <- with(retval, as.POSIXct(paste(ActivityStartDate, ActivityStartTime.Time),format="%Y-%m-%d %H:%M:%S", tz = "UTC"))
retval$ActivityStartDateTime <- retval$ActivityStartDateTime + timeZoneStart*60*60
retval$ActivityStartDateTime <- as.POSIXct(retval$ActivityStartDateTime)
attr(retval$ActivityStartDateTime, "tzone") <- "UTC"
if(tz != ""){
attr(retval$ActivityStartDateTime, "tzone") <- tz
} else {
attr(retval$ActivityStartDateTime, "tzone") <- "UTC"
}
}
if(any(!is.na(timeZoneEnd))){
retval$ActivityEndDateTime <- with(retval, as.POSIXct(paste(ActivityEndDate, ActivityEndTime.Time),format="%Y-%m-%d %H:%M:%S", tz = "UTC"))
retval$ActivityEndDateTime <- retval$ActivityEndDateTime + timeZoneEnd*60*60
retval$ActivityEndDateTime <- as.POSIXct(retval$ActivityEndDateTime)
attr(retval$ActivityEndDateTime, "tzone") <- "UTC"
if(tz != ""){
attr(retval$ActivityEndDateTime, "tzone") <- tz
} else {
attr(retval$ActivityEndDateTime, "tzone") <- "UTC"
}
}
if(all(is.na(retval$ActivityEndDateTime))){
......
......@@ -104,10 +104,10 @@
#' rawPHsites <- readWQPqw(c('USGS-05406450', 'USGS-05427949','WIDNR_WQX-133040'), 'pH','','')
#' nwisEx <- readWQPqw('USGS-04024000',c('34247','30234','32104','34220'),'','2012-12-20')
#' }
readWQPqw <- function(siteNumbers,parameterCd,startDate="",endDate=""){
readWQPqw <- function(siteNumbers,parameterCd,startDate="",endDate="",tz=""){
url <- constructWQPURL(siteNumbers,parameterCd,startDate,endDate)
retval <- importWQP(url)
retval <- importWQP(url, tz = tz)
pcodeCheck <- all(nchar(parameterCd) == 5) & all(!is.na(suppressWarnings(as.numeric(parameterCd))))
......
......@@ -61,6 +61,10 @@ whatWQPsites <- function(...){
values <- sapply(matchReturn, function(x) URLencode(as.character(paste(eval(x),collapse=";",sep=""))))
if("tz" %in% names(values)){
values <- values[!(names(values) %in% "tz")]
}
values <- gsub(",","%2C",values)
values <- gsub("%20","+",values)
values <- gsub(":","%3A",values)
......
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