rspatial / geodata

download geographic data
GNU General Public License v3.0
147 stars 15 forks source link

worldclim_tile does not return correct WorldClim bioclimatic layers #56

Open rjaffe-ramboll opened 9 months ago

rjaffe-ramboll commented 9 months ago

The function worldclim_tile, to download climate data from WorldClim (version 2.1) in tiles, does not return the correct WorldClim bioclimatic layers.

worldclim_tile gets layers from UCDavis (https://geodata.ucdavis.edu/climate/worldclim/2_1/tiles/tile/) and not from WorldClim directly (https://www.worldclim.org/data/worldclim21.html), so seems like something happened when preparing the tiles.

Here an example:

bioclim <- worldclim_tile(
  var = "bio",
  res = 0.5,
  lon = 51.19113,
  lat = 25.28342,
  path = tempdir(),
  version = "2.1"
)

summary(bioclim)

tile_32_wc2.1_30s_bio_13 tile_32_wc2.1_30s_bio_14 Min. :32.94 Min. : 33.4
1st Qu.:43.99 1st Qu.:146.4
Median :51.59 Median :444.0
Mean :56.53 Mean :425.7
3rd Qu.:70.71 3rd Qu.:651.2
Max. :91.41 Max. :961.8
NA's :31810 NA's :31810

Note the values for tile_32_wc2.1_30s_bio_13 (Precipitation of Wettest Month) are lower than the values for tile_32_wc2.1_30s_bio_14 (Precipitation of Driest Month). The layers downloaded directly from WorldClim seem to be OK.

Session Info: R version 4.2.0 (2022-04-22 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] mapview_2.11.0.9006 geodata_0.5-8 sf_1.0-14 terra_1.7-39 janitor_2.2.0
[6] lubridate_1.9.2 forcats_1.0.0 stringr_1.5.0 dplyr_1.1.2 purrr_1.0.1
[11] readr_2.1.4 tidyr_1.3.0 tibble_3.2.1 ggplot2_3.4.2 tidyverse_2.0.0

loaded via a namespace (and not attached): [1] tidyselect_1.2.0 lattice_0.20-45 snakecase_0.11.0 colorspace_2.1-0 vctrs_0.6.2
[6] generics_0.1.3 stats4_4.2.0 htmltools_0.5.6 base64enc_0.1-3 utf8_1.2.3
[11] rlang_1.1.1 e1071_1.7-13 pillar_1.9.0 glue_1.6.2 withr_2.5.0
[16] DBI_1.1.3 sp_2.0-0 lifecycle_1.0.3 munsell_0.5.0 gtable_0.3.3
[21] raster_3.6-23 htmlwidgets_1.6.2 codetools_0.2-18 tzdb_0.4.0 fastmap_1.1.1
[26] crosstalk_1.2.0 class_7.3-20 fansi_1.0.4 leafem_0.2.0 Rcpp_1.0.11
[31] KernSmooth_2.23-20 satellite_1.0.4 scales_1.2.1 classInt_0.4-9 leaflet_2.1.2
[36] hms_1.1.3 png_0.1-8 digest_0.6.33 stringi_1.7.12 grid_4.2.0
[41] cli_3.6.1 tools_4.2.0 magrittr_2.0.3 proxy_0.4-27 pkgconfig_2.0.3
[46] timechange_0.2.0 rstudioapi_0.15.0 R6_2.5.1 units_0.8-3 compiler_4.2.0

rjaffe-ramboll commented 9 months ago

Same issue identified in https://github.com/rspatial/geodata/issues/38

ManuelSpinola commented 7 months ago

Any solution to this?

gtvieira commented 7 months ago

It would be very hepful to have this sorted out. For the tiles, while checking the UCDavis folders, it seems that the problem lies there. For the world data, it would be best to have the data downloaded directly from WorldClim 2.1, since it is not downloading correct data either.