Resampling

library(terra)

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

# Create a copy of r and change its resolution to 700x700 meters
# This will be used as a template for resampling
r2 <- r
res(r2) <- 700
# Set some dummy values 
values(r2) <- 1:ncell(r2)

# Resample the raster to 700 meters using nearest neighbor method
rs <- resample(r, r2, method = "near")
plot(r)
plot(rs)
# Test that the resampled raster plays well with
# the template raster. If the rasters did not 
# match in resolution and extent, this would fail.
test <- r2 * rs
plot(test)

# Resample using bilinear method
rs <- resample(r, r2, method = "bilinear")
plot(rs)