This function is an alternative to raster::resample()
and downscales
a raster to coarser raster in a more efficient way (for large rasters).
downscale(from, to, FUN = "mean", progress = TRUE)
from | A RasterLayer, RasterStack or RasterBrick to downscale |
---|---|
to | A RasterLayer with characteristics that from should be downscale to |
FUN | The function to aggregate values (DEFAULT: "mean") |
progress | If TRUE, a progress bar is displayed |
A RasterLayer, RasterStack or RasterBrick.
library(raster)#>from <- raster(system.file("external/test.grd", package = "raster")) to <- aggregate(from, fac = 2) final <- downscale(from, to, FUN = "mean", progress = FALSE) par(mfrow = c(1, 2)) plot(from) plot(final)