make_raster_lut: Make a neighborhood LUT, where each cell value contains the...

View source: R/stars.R

make_raster_lutR Documentation

Make a neighborhood LUT, where each cell value contains the 1-d address of the closest non-missing cell (which might be itself).

Description

Make a neighborhood LUT, where each cell value contains the 1-d address of the closest non-missing cell (which might be itself).

Usage

make_raster_lut(
  x = volcano_single(threshold = 120),
  mask_value = NA,
  nonreassigned_value = "cellnumber"
)

Arguments

x

stars object, only the first layer of the first attribute is used.

mask_value

numeric, the value of masked areas, by default NA

nonreassigned_value

either "cellnumber" which indicates cell number should be used or some numeric value like NA.

Value

stars of cell addresses. Where the input, x, had non-mask values the cell addresses point to the input cell. Where the input had mask-valued cells, the output cell addresses point to the nearest non-mask cells in the input.

Examples

## Not run: 
library(stars)
library(twinkle)
v = volcano_single(threshold = 120)
lut <- make_raster_lut(v)
z <- c(mask, lut)
names(z) <- c("mask", "lut")
mplot(z)

## End(Not run)

BigelowLab/twinkle documentation built on Jan. 26, 2025, 6:34 a.m.