maskExtrapolation: Mask a projection raster removing extrapolation areas

View source: R/maskExtrapolation.R

maskExtrapolationR Documentation

Mask a projection raster removing extrapolation areas

Description

Compute and apply a mask of areas within which strict extrapolation has been detected

Usage

maskExtrapolation(
  maxnetModel,
  projRasFile,
  maskOutpath = dirname(projRasFile),
  fileLabel = NULL,
  makePlots = TRUE,
  saveMask = TRUE,
  silent = TRUE
)

Arguments

maxnetModel

Character. Full path to a maxnet model fitted by fit_maxnet and saved as an .Rd file.

projRasFile

Character. Path to a raster of the projected maxnet model to which the computed extrapolation mask will be applied.

maskOutpath

Character. Full path to the folder into which the mask raster and projection raster with mask applied will be written.

fileLabel

Character. Label to be used to distinguish the filename of the saved mask raster.

makePlots

Logical. Make basic plots of raster objects for interpretation, review and quality control? Default is TRUE.

saveMask

Logical. Should the mask raster (as distinct from the the masked version of projRas) be saved? Default is TRUE.

silent

Logical. If TRUE (default), no progress messages are written to the console.

Details

The nominated MaxEnt model object produced by fit_maxnet is interrogated to find the list of variables used in the model. The function then proceeds to:

  1. Load a raster stack of these variables

  2. Code each non-NA cell in a raster layer 1 if it is within the range of the variable recorded in the model object, 0 otherwise

  3. Compute an output raster with only cells set to 1 when all values in the stack are 1, 0 otherwise and NA cells retained

  4. Save the output raster

The file name for the output raster defaults to 'extrapolationMask.tif'. If fileLabel is not NULL, then the output file name is 'extrapolationMask_' + 'fileLabel' + '.tif'.

Value

Nothing but has side-effect of writing up to two raster files: mask raster (if saveMask == TRUE) and projection raster with mask applied plus, if makePlots == TRUE, a set of PNG graphics files.

Examples

{
## Not run: 
## Very basic use case:
maskExtrapolation("furryCreature.Rd", "currentClimate/envVarFolder",
                  "furryCreature_run1.tif", makePlots = FALSE)

## End(Not run)
}

peterbat1/fitMaxnet documentation built on Sept. 17, 2024, 10:50 p.m.