Download historic climate data for Central America
ca_historic_worldclim.Rd
This function allows you to parse from worldclim version 2.1 historic climatic files for Central America.
This function is a wrapper of the worldclim2 function from the itsdm package.
Arguments
- var
(
character
) The option for the variable to download. Should be one of tmin, tmax, prec, bio. 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.- path
(
character
) The path to save the downloaded imagery. IfNULL
, it would use the current working directory. The default isNULL
.- return_stack
(
logical
) ifTRUE
, stack the imagery together and return. If the area is large and resolution is high, it is better not to stack them. The default isTRUE
.
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.doi:10.1002/joc.5086
Examples
climate <- ca_historic_worldclim(var = "tmax",
res = 10,
path = tempdir(),
return_stack = TRUE)
#> Warning: st_crop: bounding boxes of x and y do not overlap
#> Warning: file without extension, using driver GTiff
#> Warning: file without extension, using driver GTiff
#> Warning: file without extension, using driver GTiff
#> Warning: file without extension, using driver GTiff
#> Warning: file without extension, using driver GTiff
#> Warning: file without extension, using driver GTiff
#> Warning: file without extension, using driver GTiff
#> Warning: file without extension, using driver GTiff
#> Warning: file without extension, using driver GTiff
#> Warning: file without extension, using driver GTiff
#> Warning: file without extension, using driver GTiff
#> Warning: file without extension, using driver GTiff