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

Realized I was using unlink wrong.

parent 4c3b343e
No related branches found
No related tags found
1 merge request!85Updates mainly to expose sysdata, but also improvements in readNWISdata and qw.
...@@ -30,6 +30,14 @@ ...@@ -30,6 +30,14 @@
#' } #' }
importWQP <- function(obs_url, zip=FALSE, tz=""){ importWQP <- function(obs_url, zip=FALSE, tz=""){
if(tz != ""){
tz <- match.arg(tz, c("America/New_York","America/Chicago",
"America/Denver","America/Los_Angeles",
"America/Anchorage","America/Honolulu",
"America/Jamaica","America/Managua",
"America/Phoenix","America/Metlakatla"))
}
if(zip){ if(zip){
h <- basicHeaderGatherer() h <- basicHeaderGatherer()
httpHEAD(obs_url, headerfunction = h$update) httpHEAD(obs_url, headerfunction = h$update)
...@@ -49,7 +57,6 @@ importWQP <- function(obs_url, zip=FALSE, tz=""){ ...@@ -49,7 +57,6 @@ importWQP <- function(obs_url, zip=FALSE, tz=""){
if(headerInfo['status'] == "200"){ if(headerInfo['status'] == "200"){
doc <- unzip(temp) doc <- unzip(temp)
unlink(temp)
} else { } else {
unlink(temp) unlink(temp)
...@@ -61,14 +68,6 @@ importWQP <- function(obs_url, zip=FALSE, tz=""){ ...@@ -61,14 +68,6 @@ importWQP <- function(obs_url, zip=FALSE, tz=""){
headerInfo <- attr(doc, "headerInfo") headerInfo <- attr(doc, "headerInfo")
} }
if(tz != ""){
tz <- match.arg(tz, c("America/New_York","America/Chicago",
"America/Denver","America/Los_Angeles",
"America/Anchorage","America/Honolulu",
"America/Jamaica","America/Managua",
"America/Phoenix","America/Metlakatla"))
}
numToBeReturned <- as.numeric(headerInfo["Total-Result-Count"]) numToBeReturned <- as.numeric(headerInfo["Total-Result-Count"])
if (!is.na(numToBeReturned) & numToBeReturned != 0){ if (!is.na(numToBeReturned) & numToBeReturned != 0){
...@@ -132,7 +131,10 @@ importWQP <- function(obs_url, zip=FALSE, tz=""){ ...@@ -132,7 +131,10 @@ importWQP <- function(obs_url, zip=FALSE, tz=""){
if(all(is.na(retval$ActivityEndDateTime))){ if(all(is.na(retval$ActivityEndDateTime))){
retval$ActivityEndDateTime <- NULL retval$ActivityEndDateTime <- NULL
} }
if(zip){
unlink(doc)
}
return(retval) return(retval)
} else { } else {
......
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