create_grid: Create a grid of square-shaped windows

View source: R/create_grid.R

create_gridR Documentation

Create a grid of square-shaped windows

Description

Create a grid of square-shaped windows

Usage

create_grid(x, size, shift = NULL)

Arguments

x

A SpatRaster

size

Expressed in the numbers of cells, is a length of the side of a square-shaped block of cells. It defines the extent of a local pattern. If size=NULL calculations are perfomed for the whole area

shift

Defines the shift between adjacent squares of cells along with the N-S and W-E directions. It describes the density (resolution) of the output grid. The resolution of the output map will be reduced to the original resolution multiplied by the shift. If shift=size the input map will be divided into a grid of non-overlapping square windows. Each square window defines the extent of a local pattern. If shift < size - results in the grid of overlapping square windows.

Value

An sf polygon object

Examples

library(terra)
race_raster = rast(system.file("extdata/race_raster.tif", package = "raceland"))
x = create_realizations(race_raster, 1)
y = create_grid(x, size = 10)
y

Nowosad/raceland documentation built on April 21, 2023, 10 a.m.