Builtin Library
README.md
core.raster.stencil (procNode)
Measure the shape of a layer around every cell: its slope in degrees or its curvature (the laplacian over x and z).
Built from the grid kernel in stencil mode over every stored cell, then gather through core.raster.cells to a column over the field's cells.
Inputs
raster(Raster). The raster measured.layer(String). Default"height". The layer measured.kind(one of slope, curvature). Default"slope". What is measured: the slope in degrees, or the curvature.held(Bool). Defaultfalse. Answer a column over every cell the tiles hold rather than over the cells of the field.
A cell's neighbours are the cells its tile stores around it, so a cell at the edge of the field is measured against the cells the raster holds beyond it.
Outputs
value: a Float column over the field's cells, or over the held cells.count: the cells measured.
Example
local raster = g.core.raster.new({ size = { x = 8, z = 8 }, resolution = 1, layers = { "height" } })
local slope = g.core.raster.stencil({ raster = raster, layer = "height", kind = "slope" })
A flat layer has slope 0 at every one of the 64 cells.