sits_apply()
allow any valid R expression to compute new bands.
Use R syntax to pass an expression to this function.
Besides arithmetic operators, you can use virtually any R function
that can be applied to elements of a matrix (functions that are
unaware of matrix sizes, e.g. sqrt()
, sin()
,
log()
).
Also, sits_apply()
accepts a predefined set of kernel functions
(see below) that can be applied to pixels considering its
neighborhood. sits_apply()
considers a neighborhood of a
pixel as a set of pixels equidistant to it (including itself)
according the Chebyshev distance. This neighborhood form a
square window (also known as kernel) around the central pixel
(Moore neighborhood). Users can set the window_size
parameter to adjust the size of the kernel window.
The image is conceptually mirrored at the edges so that neighborhood
including a pixel outside the image is equivalent to take the
'mirrored' pixel inside the edge.
sits_apply()
applies a function to the kernel and its result
is assigned to a corresponding central pixel on a new matrix.
The kernel slides throughout the input image and this process
generates an entire new matrix, which is returned as a new band
to the cube. The kernel functions ignores any NA
values
inside the kernel window. Central pixel is NA
just only
all pixels in the window are NA
.
By default, the indexes generated by the sits_apply()
function are
normalized between -1 and 1, scaled by a factor of 0.0001.
Normalized indexes are saved as INT2S (Integer with sign).
If the normalized
parameter is FALSE, no scaling factor will be
applied and the index will be saved as FLT4S (Float with sign).