Fill time gaps in a SpatRaster
fillTime.Rd
Add empty layers in between existing layers such that the time step between each layer is the same.
See approximate
to estimate values for these layer (and other missing values)
Arguments
- x
SpatRaster
- filename
character. Output filename
- ...
list with named options for writing files as in
writeRaster
Examples
r <- rast(system.file("ex/logo.tif", package="terra"))
s <- c(r, r)
time(s) <- as.Date("2001-01-01") + c(0:2, 5:7)
time(s)
#> [1] "2001-01-01" "2001-01-02" "2001-01-03" "2001-01-06" "2001-01-07"
#> [6] "2001-01-08"
ss <- fillTime(s)
time(ss)
#> [1] "2001-01-01" "2001-01-02" "2001-01-03" "2001-01-04" "2001-01-05"
#> [6] "2001-01-06" "2001-01-07" "2001-01-08"
a <- approximate(ss)