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

Additional Error with getTerraClim #18

Closed rsmiller74 closed 3 years ago

rsmiller74 commented 3 years ago

Running example code.

w = aoi_get("world") %>% getTerraClim(param = 'palmer', startDate = '2017-10-10') Error in if (length(dim(v)[3]) == 0 | is.na(dim(v)[3])) { : argument is of length zero

rsmiller74 commented 3 years ago

Is this package being actively maintained?

mikejohnson51 commented 3 years ago

Hi,

Yes it is, I have a largish update coming soon! I've been away from it for a bit,

The issue with the above is that "world" is no longer a supported query for aoi_get. If it is useful I can add it back in?

The other issue is issues with the palmer index from TerraClim, I hope to have an answer from the maintainers of that dataset soon (see #15)

Sorry again for the delays on these, Mike

rsmiller74 commented 3 years ago

Great! Yes "world" is very useful for those of us that use these climate data at the global scale.

mikejohnson51 commented 3 years ago

@rsmiller74 I haven't gotten around to implementing 'world' yet in AOI. But climateR is working!

Here is a work around to sustain you using`. Unfortunately they have a couple invalid geometries so two intermediate steps are needed. Hope it helps!

Mike

library(climateR)
library(rasterVis)
library(sf)
library(rnaturalearth)

w = ne_countries(returnclass = "sf") %>% 
  st_union() %>%
  st_as_sf() %>% 
  getTerraClim(param = 'palmer', startDate = '2017-10-10')

levelplot(w$palmer, margin = FALSE, par.settings = BuRdTheme)

Created on 2020-10-19 by the reprex package (v0.3.0)