Raster Cell Neighbourhoods
tj_cell_neighbours.RdRaster Cell Neighbourhoods
Details
The default is type='square' and range=1, which is 8 adjacent pixels. Increasing range=2 includes the neighbours' neighbours (24 pixels).
To return neighbourhood with corners removed, use type='circle' which drops the pixels from square-neighbourhood with distance larger than range.
To weight the further away neighbours, use type='sqexp'. It is similar to circle, but with weight decreasing exponentially in squared distance,
scaled to be 1 for distance 1.
Non-toroidal neighborhood, so at edges there will be less neighbours.
Will assume cell-numbering cell = col + (row-1) * ncol.