newhall_worldclim_cache(): Uses the geodata package to download and cache data at the specified resolution.

newhall_worldclim_rast(): Create a SpatRaster object. This object contains temperature and precipitation data for the specified data set, at the specified resolution, using the standard jNSM column naming scheme.

newhall_worldclim_subset(): Used to create a subset of the WorldClim data corresponding to the extent of an input spatial object x.

newhall_worldclim_cache(
  resolution = "10m",
  version = "2.1",
  overwrite = FALSE,
  WORLDCLIM_PATH = file.path(newhall_data_dir("cache"), "WorldClim")
)

newhall_worldclim_rast(
  resolution = "10m",
  version = "2.1",
  WORLDCLIM_PATH = file.path(newhall_data_dir("cache"), "WorldClim"),
  tiffile = list.files(file.path(WORLDCLIM_PATH, paste0("wc", version, "_", resolution)),
    pattern = "\\.tif$", recursive = TRUE)
)

newhall_worldclim_subset(
  x,
  resolution = "10m",
  template = "EPSG:4326",
  WORLDCLIM_PATH = file.path(newhall_data_dir("cache"), "WorldClim")
)

Arguments

resolution

character. Either "10m", "5m", "2.5m" or "30s". In minutes (or seconds) of degrees ("EPSG:4326").

version

character. Version number. Default: "2.1". See geodata::worldclim_global() for details.

overwrite

Force download of new cache files? Default: FALSE.

WORLDCLIM_PATH

Default: file.path(newhall_data_dir("cache"), "WorldClim")

tiffile

Optional: custom vector of paths to files to use to build raster. Defaults to all .TIF files in the specified cache directory and resolution.

x

A SpatVector, SpatRaster, SpatExtent, or any other object type suitable to use with terra::crop().

template

Template SpatRaster or target CRS specification for re-projection. Default: "EPSG:4326

Value

character. Vector of file paths (to WorldClim .TIF files).

References

Fick, S.E. and R.J. Hijmans, 2017. WorldClim 2: new 1km spatial resolution climate surfaces for global land areas. International Journal of Climatology 37 (12): 4302-4315. https://www.worldclim.org/data/worldclim21.html