get_rasters: Retrieve and organize spatial environmental information.

Description Usage Arguments Value Examples

View source: R/get_rasters.R

Description

get_rasters returns an organized list of environmental rasters.

Usage

1
2
3
4
5
get_rasters(raster_source = NULL, ext = c(-180, 180, -60, 90),
  margin = 0, resolution = 10, non_fixed_var = NULL,
  fixed_var = NULL, years = "present", scenarios = NULL,
  baseline = "present", separator = "_", projection_model = "MP",
  reorder = FALSE, download_source = "pkg-raster", alert = NULL)

Arguments

raster_source

character or list of RasterStack. You can either input a path to a folder with the required rasters or a list of RasterStack organized by year/scenario.

ext

numeric vector or dataframe with coordinates. Extension to crop rasters. Input can be either a vector with limiting latitudes and longitudes or a table of coordinates. In case the input is a numeric vector, the order of values should be: western most longitude, easter most longitude, southern most latitude then northern most latitude. Longitude values west of GMT and latitude values south of equator are distinguished by a negative sign. In case the input is a table of coordinates, the points further in each direction will determine the extent for cropping.

margin

numeric. Additional distance to be added to margin of extent, in degrees.

resolution

numeric. Spatial resolution of rasters, in degrees. This is used for downloading only.

non_fixed_var

character vector. Names of the time varying variables to be outputed. This variables will be subject to variation according to argument 'years'.

fixed_var

character vector. Names of the time fixed variables to be outputed. This variables will not be subject to variation according to argument 'years'.

years

character vector. Names of years for time varying variables.

scenarios

character vector. Names of future scenarios to for time varying variables.

baseline

character vector. Names of years not subject to scenarios.

separator

character. Character that separates variable names, years and scenarios.

projection_model

character. Projection model for future variables. Must be any model accepted in raster::getData

reorder

logical. If TRUE, will use last two characters of layer names in RasterStacks with 12 layers to order them in ascending order.

download_source

character. Where to download rasters from. Default is 'pkg-raster' which will get rasters from WorldClim, using package 'raster' functions.

alert

integer. Plays a sound alert when function is done running. See documentation of package beepr for description of sound options.

Value

Returns a list of raster stacks for the variables required, organized by year/scenario combination.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Fulanus_Ecorasters_download <-
#   get_rasters(
#     ext = FulanusDistribution,
#     margin = 5,
#     non_fixed_var = c('prec', 'tmin', 'tmax'),
#     years = c("present", '2050', '2070'),
#     scenarios = c('rcp26', 'rcp45', 'rcp85'),
#     alert = 6)

Fulanus_Ecorasters_dir <-
  get_rasters(
    raster_source = "/Users/gabriel/Documents/Mapinguari/global_grids_10_minutes",
    ext = FulanusDistribution,
    margin = 5,
    non_fixed_var = c('prec', 'tmin', 'tmax'),
    fixed_var = "alt",
    years = c("present", '2050', '2070'),
    scenarios = c('rcp26', 'rcp45', 'rcp85'),
    reorder = TRUE,
    alert = 4)

gabrielhoc/MapinguariLegacy documentation built on May 8, 2019, 9:54 p.m.