penvs_bgMask: penvs_bgMask Mask environmental data

View source: R/penvs_bgMask.R

penvs_bgMaskR Documentation

penvs_bgMask Mask environmental data

Description

This functions crops and masks the environmental data to the provided background area.

Usage

penvs_bgMask(occs, envs, bgExt, logger = NULL, spN = NULL)

Arguments

occs

data frame of cleaned or processed occurrences obtained from components occs: Obtain occurrence data or, poccs: Process occurrence data.

envs

a RasterStack or RasterBrick of environmental layers to be processed. This determines the output type.

bgExt

a SpatialPolygonsDataFrame with the background area to be used for processing.

logger

Stores all notification messages to be displayed in the Log Window of Wallace GUI. Insert the logger reactive list here for running in shiny, otherwise leave the default NULL.

spN

species name to be used for all logger messages

Details

This function is used in the select study region component. Here, the environmental layers to be used in the modeling are cropped and masked to the provided background area. The background area is determined in the function penvs_bgExtent from the same component. The function returns the provided environmental layers cropped and masked in the provided format (either a rasterBrick or a rasterStack).

Value

A RasterStack or a RasterBrick of environmental layers cropped and masked to match the provided background extent.

Author(s)

Jamie Kass <jamie.m.kass@gmail.com>

Gonzalo E. Pinilla-Buitrago <gepinillab@gmail.com>

See Also

penvs_userBgExtent, penvs_drawBgExtent, penvs_bgExtent, penvs_bgSample

Examples

## Not run: 
occs <- read.csv(system.file("extdata/Bassaricyon_alleni.csv",
                 package = "wallace"))[, 2:3]
occs$occID <- 1:nrow(occs)
envs <- envs_userEnvs(rasPath = list.files(system.file("extdata/wc",
                                           package = "wallace"),
                      pattern = ".tif$", full.names = TRUE),
                      rasName = list.files(system.file("extdata/wc",
                                           package = "wallace"),
                      pattern = ".tif$", full.names = FALSE))
bgExt <- penvs_bgExtent(occs, bgSel = 'bounding box', bgBuf = 0.5)
bgMask <- penvs_bgMask(occs, envs, bgExt)

## End(Not run)


wallace documentation built on Sept. 26, 2023, 1:06 a.m.