The version of r only changes with a new SpatRaster object (terra's [<- and values<- make one) or different sampled values (rasterSample()); mod$rasterStamp keeps the last object, so its address cannot be reused by another. It is for the key of mod$surface, so the full raster is not read every replicate.

rasterVersion(name, r)

Arguments

name

character; mod$rasterStamp entry.

r

A SpatRaster, or NULL.

Value

An integer; NULL for NULL.