sigm <- function(x) { .8 / (1 + exp(-(x-10))) + runif(length(x))/4 }
r <- rast(ncols=10, nrows=10, nlyr=50)
s <- seq(5.2, 15,.2)
set.seed(1)
values(r) <- t(replicate(100, sigm(s)))
x <- clamp_ts(r, TRUE, TRUE)
plot(unlist(r[4]))
lines(unlist(x[4]))
Run the code above in your browser using DataLab