Skip to contents

Standardises all layers in a SpatRaster to a scale of 0-1, by dividing by the maximum value in each layer. Only operates by layer

Usage

std_rast(x, reverse, filename = NULL, overwrite = TRUE)

Arguments

x

SpatRaster to standardise

reverse

logical if TRUE will subtract standardised values from 1

filename

Optional character path and filename to write output

overwrite

logical if TRUE will overwrite filename

Value

A SpatRaster with range 0-1

Details

Will break for non-numeric rasters

Examples

example_raster(seed = 3010) |>
  std_rast(reverse = TRUE)
#> class       : SpatRaster 
#> dimensions  : 10, 10, 1  (nrow, ncol, nlyr)
#> resolution  : 1, 1  (x, y)
#> extent      : 0, 10, 0, 10  (xmin, xmax, ymin, ymax)
#> coord. ref. :  
#> source(s)   : memory
#> name        :   example 
#> min value   : 0.0000000 
#> max value   : 0.9897896