spatial.tools (version 1.6.0)

projectRaster_rigorous: Performs an area-weighted resampling of raster datasets.

Description

Performs an area-weighted resampling of raster datasets.

Usage

projectRaster_rigorous(from, to, method = "mode", na.rm = FALSE,
  verbose = FALSE, ...)

Arguments

from

Raster* The sources raster to be resampled.

to

Raster* A target raster that the from will be resampled to (extent, resolution, projection).

method

Character. Default is "mode". See details.

na.rm

Logical. Remove NAs before calculating cell stats?

verbose

logical. Enable verbose execution? Default is FALSE.

...

Currently unsupported.

Details

This function is designed to solve the problem of resampling/reprojecting rasters using area-based, not point based (e.g. nearest neighbor, bilinear, cubic convolution), resampling. The output pixel is a function of the areas of the input pixels, so this should be used for resampling from a finer resolution to a coarser resolution.

The method defaults to "mode", which will return the value covering the largest area of the output pixel area. Other methods will be added in the future.

A word of warning: this algorithm is SLOW. The function uses focal_hpc, so we highly recommend using it with a foreach engine running (e.g. use sfQuickInit() ). Keep in mind this is a "dirty" parallel problem, so different chunks may execute at different speeds and have different memory footprints.

See Also

projectRaster, extract, aggregate