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

Cleaned up some code.

parent b6969570
No related branches found
No related tags found
1 merge request!15Fixed some bugs, changed getGeneralWQPData to getWQPData
......@@ -27,6 +27,5 @@ getNWISData <- function(service="dv", ...){
}
retval <- getRDB1Data(urlCall)
return(retval)
}
......@@ -22,7 +22,6 @@
#' unitDataURL <- constructNWISURL(siteNumber,property,
#' as.character(Sys.Date()),as.character(Sys.Date()),'uv',format='tsv')
#' unitData <- getRDB1Data(unitDataURL, asDateTime=TRUE)
#' mulitSites <- getRDB1Data("http://waterservices.usgs.gov/nwis/dv/?format=rdb&stateCd=OH&parameterCd=00010")
getRDB1Data <- function(obs_url,asDateTime=FALSE){
retval = tryCatch({
......@@ -79,10 +78,10 @@ getRDB1Data <- function(obs_url,asDateTime=FALSE){
mostCommonTZ <- names(sort(summary(as.factor(timeZone)),decreasing = TRUE)[1])
data[,regexpr('d$', dataType) > 0] <- as.POSIXct(data[,regexpr('d$', dataType) > 0], "%Y-%m-%d %H:%M", tz = mostCommonTZ)
data[,grep('d$', dataType)] <- as.POSIXct(data[,grep('d$', dataType)], "%Y-%m-%d %H:%M", tz = mostCommonTZ)
additionalTZs <- names(sort(summary(as.factor(timeZone)),decreasing = TRUE)[-1])
for(i in additionalTZs){
data[timeZone == i,regexpr('d$', dataType) > 0] <- as.POSIXct(data[,regexpr('d$', dataType) > 0], "%Y-%m-%d %H:%M", tz = i)
data[timeZone == i,grep('d$', dataType)] <- as.POSIXct(data[,grep('d$', dataType)], "%Y-%m-%d %H:%M", tz = i)
}
}
......@@ -90,8 +89,6 @@ getRDB1Data <- function(obs_url,asDateTime=FALSE){
for (i in grep('d$', dataType)){
data[,i] <- as.Date(data[,i])
}
}
}
......
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