ecospat.rcls.grd: Reclassifying grids function

View source: R/ecospat.sampling.R

ecospat.rcls.grdR Documentation

Reclassifying grids function

Description

Function for reclassifying grid files to get a combined statification from more than one grid

Usage

ecospat.rcls.grd(in_grid,no.classes)

Arguments

in_grid

A SpatRaster to be reclassified.

no.classes

The number of desired new classes.

Details

This function reclassifies the input grid into a number of new classes that the user defines. The boundaries of each class are decided automatically by splitting the range of values of the input grid into the user defined number of classes.

Value

Returns a reclassified SpatRaster object

Author(s)

Achilleas Psomas achilleas.psomas@wsl.ch and Niklaus E. Zimmermann niklaus.zimmermann@wsl.ch

Examples


library(terra)
library(classInt)
library(biomod2)

data("bioclim_current")
bioclim_current <- terra::rast(bioclim_current)
bio3 <- bioclim_current[["bio3"]]
bio12 <- bioclim_current[["bio12"]]

B3.rcl<-ecospat.rcls.grd(bio3,9) 
B12.rcl<-ecospat.rcls.grd(bio12,9)
B3B12.comb <- B12.rcl+B3.rcl*10

# Plotting a histogram of the classes
hist(B3B12.comb,breaks=100,col=heat.colors(88)) 
# Plotting the new SpatRaster (9x9 classes)
plot(B3B12.comb,col=rev(rainbow(88)),main="Stratified map") 


ecospat documentation built on July 4, 2024, 5:06 p.m.