Fill layers with cell-varying ranges defined by a start and end SpatRaster. The range must start at 1 and end at a user-defined maximum.
For example, for a cell with start=3, end=5 and with limit=8, the output for that cell would be 0,0,1,1,1,0,0,0
Usage
# S4 method for SpatRaster
rangeFill(x, limit, circular=FALSE, filename="", ...)
Value
SpatRaster
Arguments
x
SpatRaster with at two layers. The Cell values of the first layer indicate the start of the range (1 based); the cell values are indicate the end of the range
limit
numeric > 1. The range size
circular
logical. If TRUE the values are considered circular, such as the days of the year. In that case, if first > last the layers used are c(first:limit, 1:last). Otherwise, the range would be considered invalid and NA would be used
filename
character. Output filename
...
additional arguments for writing files as in writeRaster