Search code examples
rmodelingtidymodelsmaxent

Error Downloading Chelsa Climate Data with pastclim


I attempted to download the current chelsa 2.1 climate variables using pastclim. However, I keep getting the error:

Error: buildvrt: options error.

terra, gdal, and pastclim are up-to-date. Is this a bug, or is there a problem with my code?

library(pastclim)

set_data_path(here::here("climate_vars", "chelsa"))

#> The data path will be set to
#> C:\Users\garre\oneDrive\Desktop\DIVE_Files\DIVE_Analysis\Climate_vars\chelsa.
#> A copy of the Example dataset will be copied there.
#> This path will be saved by pastclim for future use.
#> Proceed?
#> 1: Yes
#> 2: No

download_dataset(dataset = "CHELSA_trace21k_1.0_0.5m_vsi")

#> Error: buildvrt: options error

Note that I am attempted to download the past chelsa data in this code snippet, and that also threw the same error.


Solution

  • I initially thought that this error was linked to the URLs for CHELSA having changed, but that was a red herring. Given the error message, the problem is a regression in gdal buildvrt interface through sf in Windows, which currently does not accept the -overwrite flag.

    In any case, both problems are now fixed in the new version of pastclim on CRAN (version 2.2.0), as well as in the dev version on r-universe as suggested by @L Tyrone.