SLIDE Rasters 1 4.3
- Subsetting
- Local Operations
- Raster algebra. - adding, subtracting, squaring, multiplying, logical filter ex >5 example
- terra examples in Fig 4.11
- classification of intervals of numeric values into groups - ex DEM
- classify() with a reclassifaction matrix making the 3 groupings (1/2/3 low/middle/high)
- more efficient functions: app(), tapp(), lapp()
- app() - applies a function to each cell of a raster
- used to summarize - calculating the sum of multiple layers into one layer
- tapp() - an extension of app() which allows selecting a subset of layers
- lapp() - apply a function to each cell using layers as an argument
- NDVI - Normalized Difference Vegetation Index is example using lapp() in raster algebra - see fig 4.12 example
- Focal Operations
- central (focal) cell and its neighbors
- neighborhood -(also called kernel, filter, or moving window)
- typical example a 3x3 rectangular matrix around the central / focal cell
- applies aggregation function
- also called spatial filtering or convolution
- focal() function in R
- matrix defines the shape of the moving window - w weight in example
- fun - function example uses min - but other summary functions like sum(), mean(), var() can be used
- additional arguments - remove NA=True na.rm=TRUE or False na.rm=FALSE - see Fig 4.13
- Zonal Operations
- 2nd raster usually with categorical values defines the zonal filter or zones
- so don’t have to be neighbors
- Output is summary table grouped by the categorical values
- called Zonal Statistics in GIS world
- Global Operations and Distances
- special case of Zonal operations with entire raster representing a single zone
- Descriptive statistics for entire raster such as Min or Max
- useful for calculation of distance from each cell to a target cell
- also includes Visibility and View shed computations