ropensci/prism

Empty Folders

Patrick-Thomas-Corbett opened this issue · 1 comments

I have been working with the below code (code is same for all variables). This was working fine for tmin, tmax, prp, but for tmean it only created empty folders. The folders were correctly named, but they were just empty. I have not been able to correct this.

Later, I ran the whole notebook again and I realized that some years for Tmin didn't have any data and were now with empty folders, just like tmin. I tried running it again and this time the tmin section was ALL empty folders. Seeing how I was regressing, I tried the tmax and it was ok, but the tmin still did not work. Then tmax started giving empty folders.

Essentially tmean never worked (code ran but only gave empty files). What did work no longer works even though I did not make any changes to the code. Any input?

library(devtools) #needed to download prism from github
library(reshape2) ##melting dataframes
library(dplyr) #data wrangling
library(raster) ##working with raster data
r = getOption("repos")
r["CRAN"] = "http://cran.us.r-project.org"
options(repos = r)
library(prism)

options(prism.path ='C:/Users/Patrick/Documents/GitHub/AedesHere/data/Prism_Monthly/tmin')

for(i in 1:12)
{
print("Working on tmin month")
print(i)
get_prism_monthlys(type="tmin", years = 2013:2019, mon = i, keepZip=F)

}

@PatTCor

Hmm. I'm able to download monthly tmean and tmin successfully. The following code produces the following two figures (just a as a quick way to see if there is data in all the folders). Can you try running this code as see if it works? It's adapted from the code in the vignette.

options(prism.path = "~/prism")

library(ggplot2)
library(prism)

boulder <- c(-105.2797,40.0176)

# tmin
get_prism_monthlys(type="tmin", years = 2013:2019, mon = 1:12, keepZip = FALSE)

to_slice <- grep("tmin",ls_prism_data()[,1],value = TRUE)

p <- prism_slice(boulder,to_slice)
p + ggtitle("tmin")

# tmean
get_prism_monthlys(type="tmean", years = 2013:2019, mon = 1:12, keepZip = FALSE)

to_slice <- grep("tmean",ls_prism_data()[,1],value = TRUE)
p <- prism_slice(boulder, to_slice)
p + ggtitle("tmean")

image

image