nh_burn: Add areas represented by features ('burn-in') to a binary...

View source: R/nh_burn.R

nh_burnR Documentation

Add areas represented by features ('burn-in') to a binary raster SDM output, plus areas within a buffer distance above a threshold

Description

Takes spatial features, a continuous raster (values between 0 and 1), and returns a classified binary (0/1) raster. Areas intersecting spf features are assigned a value of 1 in the returned classified raster. Additionally, areas within buffer distance of spf and above the threshold are set to 1. See details for default calculation of orig.thresh and usage of buffer.

Usage

nh_burn(spf, rast, orig.thresh = NULL, buffer = NA, return.thresh = FALSE)

Arguments

spf

input spatial features (sp or sf spatial object)

rast

input raster model output (values between 0 and 1)

orig.thresh

numeric between 0 and 1; threshold value to apply to raster

buffer

numeric; spatial buffer distance around spf where threshold will be applied.

return.thresh

logical; whether to return thresholds along with raster in a list

Details

When buffer is used or orig.thresh is not provided, a minimum cell value (min.cell) of values within spf is calculated and used as the threshold.

The default is to return the raster only. If return.thresh = TRUE, the function will return a list with 3 named objects: rast, the output raster; orig.thresh, the global threshold (if used); min.cell, the minimum cell value threshold (if used).

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")
full_burn <- nh_burn(spf, rast, buffer = NA)
buff_burn <- nh_burn(spf, rast, buffer = 10000)

## End(Not run)

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