# import raster image
data(normforest)
normforest <- terra::unwrap(normforest)
# basic values
z <- terra::values(normforest)
# calculate cumulative probability density function of surface 'height' (= ndvi)
mod <- ecdf((1 - z))
# valley fluid retention index = void volume in 'valley' zone
Svi <- area_above(f = mod, b = 1, a = 0.8, n = 500)
Run the code above in your browser using DataLab