diff --git a/R/importWaterML1.r b/R/importWaterML1.r index afc12c974c319331da651f02054a5ca947d4544a..9d3112b1017d404fd69af3da1b677e605cabb741 100644 --- a/R/importWaterML1.r +++ b/R/importWaterML1.r @@ -87,6 +87,10 @@ #' fullPath <- file.path(filePath, fileName) #' imporFile <- importWaterML1(fullPath,TRUE) #' +#'#Timezone change with specified local timezone: +#' tzURL <- constructNWISURL("04027000", c("00300","63680"), "2011-11-05", "2011-11-07","uv") +#' tzIssue <- importWaterML1(tzURL, TRUE, "America/Chicago") +#' importWaterML1 <- function(obs_url,asDateTime=FALSE, tz=""){ if(file.exists(obs_url)){ @@ -273,13 +277,13 @@ importWaterML1 <- function(obs_url,asDateTime=FALSE, tz=""){ } } - if(tz != ""){ - attr(datetime, "tzone") <- tz - df$tz_cd <- rep(tz, nrow(df)) - } else { - attr(datetime, "tzone") <- "UTC" - df$tz_cd <- rep("UTC", nrow(df)) - } +# if(tz != ""){ +# attr(datetime, "tzone") <- tz +# df$tz_cd <- rep(tz, nrow(df)) +# } else { +# attr(datetime, "tzone") <- "UTC" +# df$tz_cd <- rep("UTC", nrow(df)) +# } } else { @@ -308,9 +312,6 @@ importWaterML1 <- function(obs_url,asDateTime=FALSE, tz=""){ } columnsOrderd <- columnsOrdered[columnsOrdered %in% names(df)] - - - df <- df[,columnsOrderd] if (is.null(mergedDF)){ @@ -456,6 +457,14 @@ importWaterML1 <- function(obs_url,asDateTime=FALSE, tz=""){ mergedDF <- data.frame() } + if(tz != ""){ + attr(mergedDF$dateTime, "tzone") <- tz + mergedDF$tz_cd <- rep(tz, nrow(mergedDF)) + } else { + attr(mergedDF$dateTime, "tzone") <- "UTC" + mergedDF$tz_cd <- rep("UTC", nrow(mergedDF)) + } + variableInformation$noDataValue <- rep(NA, nrow(variableInformation)) row.names(mergedDF) <- NULL