README.md

climatedata package

Working with climatedata

To install the package run:

devtools::install_github("mirzacengic/climatedata")

List of functions:

This package currently contains a function for downloading CHELSA climate data. It can download past, current, and future scenarios for bioclim data. Other variables and other climate datasets will be implemented later.

To retrieve WorldClim data, use raster::getData() function.

Note to self: there was some activity related with this in "https://github.com/gndaskalova/grabr", but the project isn't going anywhere now it seems...

NOTE: This package relies on the archive package for extracting 7zip files. This package is not available on CRAN, so please install the development version in order to use climatedata package.

devtools::install_github("jimhester/archive")

Usage:

library(climatedata)
library(tidyverse)
library(archive)
# Get models with all 4 RCP scenarios
models_all_rcp <- check_models() %>% 
group_by(model) %>%
  mutate(n = n()) %>%
  ungroup() %>%
  filter(n == 4) %>%
  distinct(model) %>%
  pull()

my_output_directory <- "/vol/milkunarc/mcengic/Data_RAW/CHELSA/Future_2050"


chelsa_bioclim <- get_chelsa(output_dir = my_output_directory, period = "future",
                             future_years = "2041-2060", scenario_string = "rcp85",
                             model_string = models_all_rcp, return_raster = FALSE)

~~Important - get_chelsa() function only works on UNIX system with 7z installed. Figure out how to unzip .7z files without using external software (if possible).~~

Meanwhile, get_chelsa() function was updated to use archive::archive_extract() function.



MirzaCengic/climatedata documentation built on Aug. 30, 2020, 1:35 p.m.