future_worldclim2: A function to parse the future climate from worldclim version...

View source: R/future_worldclim2.R

future_worldclim2R Documentation

A function to parse the future climate from worldclim version 2.1.

Description

This function allows you to parse worldclim version 2.1 future climatic files with a setting of boundary and a few other options.

Usage

future_worldclim2(
  var = "tmin",
  res = 10,
  gcm = "BCC-CSM2-MR",
  ssp = "ssp585",
  interval = "2021-2040",
  bry = NULL,
  path = NULL,
  nm_mark = "clip",
  return_stack = TRUE
)

Arguments

var

(character) The option for the variable to download. Should be one of tmin, tmax, prec, bioc. The default is tmin.

res

(numeric) The option for the resolution of image to download. Should be one of 0.5, 2.5, 5, 10. The default is 10.

gcm

(character) The option for global climate models. Check https://www.worldclim.org for all available GCM.

ssp

(character) The option for Shared Socio-economic Pathways. Should be one of "ssp126", "ssp245", "ssp370", "ssp585". The default is "ssp585".

interval

(character) The option for time interval. Should be one of "2021-2040", "2041-2060", "2061-2080", "2081-2100". The default is "2021-2040".

bry

(sf or sp) The boundary to mask the downloaded original data. If NULL, it would get global map. If not NULL, it can take sf, sfc, SpatialPolygonsDataFrame, SpatialPolygons, etc. The default is NULL.

path

(character) The path to save the downloaded imagery. If NULL, it would use the current working directory. The default is NULL.

nm_mark

(character) the name mark of clipped images. The default is "clip". It would be ignored if bry is NULL.

return_stack

(logical) if TRUE, stack the imagery together and return. If the area is large and resolution is high, it is better not to stack them. The default is TRUE.

Details

Web page page for this dataset

Value

if return_stack is TRUE, the images would be returned as a stars. Otherwise, nothing to return, but the user would receive a message of where the images are.

Note

If it fails due to slow internet, try to set a larger timeout option, e.g., using options(timeout = 1e3).

References

Fick, Stephen E., and Robert J. Hijmans. "WorldClim 2: new 1-km spatial resolution climate surfaces for global land areas." International journal of climatology 37.12 (2017): 4302-4315.\Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/joc.5086")}

Examples

## Not run: 
future_worldclim2("tmin", 10, "BCC-CSM2-MR",
  "ssp585", "2021-2040",
  path = tempdir(), return_stack = FALSE)

## End(Not run)


itsdm documentation built on July 9, 2023, 6:45 p.m.