Aggregation

library(terra)

r <- rast("data/source/fire/ca3658211879520210912_20191118_20211117_rdnbr_ba4.tif")

# Aggregate the raster by a factor of 2 using a modal function
aggr2 <- aggregate(r, fact = 2, fun = 'modal')
plot(aggr2)
# aggregate by factor of 10 
aggr10 <- aggregate(r, fact = 10, fun = 'modal')
plot(aggr10)
# Disaggregate
dagg <- disagg(aggr10, fact = 10)
plot(dagg)