Skip to contents

This function summarizes predictors to dual mesh. Predictors are assumed to be numerical values.

Usage

dmesh_predictors(dmesh, predictors, ...)

Arguments

dmesh

A dual mesh

predictors

A SpatRaster with predictor values. If processing in parallel, the SpatRaster needs to be wrapped using terra::wrap.

...

Further arguments to pass to exactextractr::exact_extract, such as progress = TRUE.

Value

A list to which an element predictors is added with a data.frame of predictor values.

Details

Parallelization can be enabled by choosing a plan from the future package and the mesh will be splitted in chunks detemined by the number of workers. Don't forget to reset the plan to sequential when done.

When the predictors do not cover the extent of the dual mesh, empty cells will be filled with the value of the nearest neighbour cell.