aggregate_raster: Downscale raster resolution

View source: R/aggregate_raster.R

aggregate_rasterR Documentation

Downscale raster resolution

Description

Aggregate raster cells (and optionally layers) to coarser resolution.

Usage

aggregate_raster(
  rast,
  outfile,
  aggregate_factor,
  fun = sum,
  return_rast = FALSE
)

Arguments

rast

Raster* object or file path to a raster file.

outfile

Character. Output raster file path. If not provided, object will be returned to R. Directory will be created recursively if it does not exist.

aggregate_factor

Integer. Aggregation factor expressed as number of cells in each direction (horizontally and vertically). Or a vector of two integers (horizontal and vertical aggregation factors) or three integers (when also aggregating over layers).

fun

Function. Function used to aggregate values. Default is sum.

return_rast

Logical. Should the resulting raster be returned to R? Ignored if outfile is not provided.

Value

If outfile is specified, the resulting raster is saved as a geotiff to that path. If return_rast is TRUE or outfile is not specified the resulting raster is returned, otherwise NULL is returned invisibly.


jscamac/edmaps documentation built on June 11, 2022, 1:26 a.m.