worldclim_countries() and worlrldclim_tiles() always fetch 30-arcmin rasters, despite "res" argument
adamlilith opened this issue · 1 comments
adamlilith commented
I've been finding that the worldclim_countries
and worldclim_tile
functions always download the 30-arcmin version of rasters despite specifying res
to be something else. This happens even after I clean out the previously downloaded files and restart R.
library(geodata)
bios <- geodata::worldclim_country('MDG', var='bio', res=10, path=getwd())
bios
class : SpatRaster
dimensions : 1740, 900, 19 (nrow, ncol, nlyr)
resolution : 0.008333333, 0.008333333 (x, y)
extent : 43, 50.5, -26, -11.5 (xmin, xmax, ymin, ymax)
coord. ref. : lon/lat WGS 84 (EPSG:4326)
source : MDG_wc2.1_30s_bio.tif
names : wc2.1~bio_1, wc2.1~bio_2, wc2.1~bio_3, wc2.1~bio_4, wc2.1~bio_5, wc2.1~bio_6, ...
min values : 11.29167, 6.12500, 54.04762, 90.91286, 18.6, 2.0, ...
max values : 28.05000, 16.55833, 77.26189, 327.99295, 36.8, 21.2, ...
Same thing for:
- other variables (tmin, tmax, prec)
worldclim_tile
However, worldclim_global
does get the correct resolution rasters when res
is specified.
> sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C LC_TIME=English_United States.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] geodata_0.4-11 terra_1.6-17
loaded via a namespace (and not attached):
[1] compiler_4.2.1 tools_4.2.1 Rcpp_1.0.9 codetools_0.2-18
rhijmans commented
That is because they do not have an argument "res". Only worldclim_global
has that argument (see the arguments under "Usage"). What happens is that argument res gets passed on to, and silently ignored by download.files
.