nh_map: Make a suitable/unsuitable binary map, given a continuous SDM...

View source: R/nh_map.R

nh_mapR Documentation

Make a suitable/unsuitable binary map, given a continuous SDM output or raster template, burn-in features, and masks

Description

This function performs a reclassification of a continuous map to a binary one, and then performs additional changes to the binary map, depending on inputs. If no continuous map is to be used, then a template raster should be given to rast.

Usage

nh_map(
  rast,
  thresh = NULL,
  feature.occ = NULL,
  feature.burn = NULL,
  feature.mask = NULL,
  raster.mask = NULL,
  patch.drop = NULL
)

Arguments

rast

input raster model output (values between 0 and 1); if no model, a template raster must be provided

thresh

numeric between 0 and 1; 'global' threshold value to apply to rast

feature.occ

input feature occurrences, to burn-in to map (sp or sf spatial object)

feature.burn

input feature(s), to burn-in to map (sp or sf spatial object)

feature.mask

input feature mask to apply to map (sp or sf spatial object)

raster.mask

input raster mask to apply to map (should match rast resolution)

patch.drop

patch size (in rast area units) to remove from map

Details

Reclassification (when thresh is given) is always performed first. After this, optional masks are applied where areas within features (feature.mask) and not NoData (raster.mask) are kept (value = 1). All other cells are given (value = 0).

Patches (contiguous groups of cells = 1) are then be dropped by specifying a minimum patch size to patch.drop in area units of the raster's CRS (see nhSDM::nh_patchdrop).

The final step is to 'burn in' (rasterize with value = 1) features from feature.occ and feature.burn. Because it is the last step, it is not affected by masks or patch dropping.

Value

SpatRaster

Author(s)

David Bucklin

Examples

## Not run: 
spf <- sf::st_read("_data/occurrence/ambymabe.shp")
rast <- terra::rast("_data/species/ambymabe/outputs/model_predictions/ambymabe_20171018_130837.tif")
feature.burn <- st_buffer(spf, 250)
feature.mask <- st_buffer(spf, 50000)
raster.mask <- rast("D:/PSH/inputs/species_masks/no_med_hi_dev/no_med_hi_dev.tif")
map <- nh_map(rast, thresh=0.75, feature.occ=spf, feature.burn=feature.burn, 
   feature.mask=feature.mask, raster.mask=raster.mask, NULL)

## End(Not run)

VANatHeritage/nhSDM documentation built on Feb. 1, 2024, 6:39 a.m.