mikejohnson51 / climateR

An R 📦 for getting point and gridded climate data by AOI
https://mikejohnson51.github.io/climateR/
MIT License
168 stars 40 forks source link

Problem using the "get PRISM" command. #12

Closed mmfava closed 4 years ago

mmfava commented 4 years ago

Hello, I need help with an error.

I had a problem with the "getPRISM" command: The moment I request the download of TerraClimate variables using a polygon for Argentina, I end up having the following problem:

AOI = aoi_get(country = "Argentina") AOI

p = getPRISM(AOI, param = c('tmax', 'tmin', 'prcp'), startDate = "2014-01-01", endDate = "2019-12-30")

Error in define.grid3(AOI, id) : Requested AOI not in model domain

Can anybody help me, please?

best regards (: Marília

mmfava commented 4 years ago

Oops! The mistake was human here. I found that the getPRISM command does not work for Terra Climate. Sorry!

mikejohnson51 commented 4 years ago

Awesome :)

Just in case you didn't find the TerraClim function (the documentation here needs some TLC):

library(AOI)
library(climateR)
library(raster)

p = aoi_get(country = "Argentina") %>% 
    getTerraClim(param = c('tmax', 'tmin', 'prcp'), startDate = "2014-01-01")

par(mfrow = c(1,3))
for(i in 1:3){
  plot(p[[i]], main = names(p)[i])
  plot(AOI$geometry, add = T, color = NA)
}

Good luck!