# raster.transformation: Statistical transformation for rasters In jeffreyevans/spatialEco: Spatial Analysis and Modelling Utilities (development version)

## Description

Transforms raster to a specified stastical transformation

## Usage

 1 raster.transformation(x, trans = "norm", smin = 0, smax = 255)

## Arguments

 x raster class object trans Transformation method: "norm", "rstd", "std", "stretch", "nl", "slog", "sr" (please see notes) smin Minimum value for stretch smax Maxmum value for stretch

## Value

raster class object of transformation

## Note

("norm") Normalization [0-1]: if min(x) < 0 ( x - min(x) ) / ( max(x) - min(x) ) ("rstd") Row standardize [0-1]: if min(x) >= 0 x / max(x) This normalizes data with negative distributions ("std") Standardize: (x - mean(x)) / sdv(x) ("stretch") Stretch: ((x - min(x)) * max.stretch / (max(x) - min(x)) + min.stretch) This will stretch values to the specified minimum and maximum values (eg., 0-255 for 8-bit) ("nl") Natural logarithms: if min(x) > 0 log(x) ("slog") Signed log 10 (for skewed data): if min(x) >= 0 ifelse(abs(x) <= 1, 0, sign(x)*log10(abs(x))) ("sr") Square-root: if min(x) >= 0 sqrt(x)

## Author(s)

Jeffrey S. Evans <[email protected]>

## Examples

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 library(raster) r <- raster(nrows=100, ncols=100, xmn=571823, xmx=616763, ymn=4423540, ymx=4453690) r[] <- runif(ncell(r), 1000, 2500) # Postive values so, can apply any transformation for( i in c("norm", "rstd", "std", "stretch", "nl", "slog", "sr")) { print( raster.transformation(r, trans = i) ) } # Negative values so, can't transform using "nl", "slog" or "sr" r[] <- runif(ncell(r), -1, 1) for( i in c("norm", "rstd", "std", "stretch", "nl", "slog", "sr")) { try( print( raster.transformation(r, trans = i) ) ) }

jeffreyevans/spatialEco documentation built on Aug. 11, 2018, 1:08 p.m.