temporal_interpolate | R Documentation |
temporal_interpolate
is applicable for multiband raster image, where bands are regular timestamps or period. For each cell (local operation of map algebra), NA
value is replaced by averaging of two closest values (one value before, one value later) inside of moving window.
temporal_interpolate(obj, win = 7, cover = 0, verbose = FALSE)
obj |
Object of class |
win |
Positive integer. Size of moving window. Required odd value; otherwise is coerced to the closest odd integer. |
cover |
Not applicable. For consistence call with |
verbose |
Logical. |
Function uses weighted averaging depending of proximity of found non-NA
values. For example, if ind
is temporal index of NA
value in the center of movind window, indL=ind-2
is temporal index of the closest early value valL
, and indR=ind+1
is temporal index of the closest late value valR
, then result is val <- (1/3) * valL + (2/3) * valR
.
ursaRaster
object, if obj
is object of class ursaRaster
.
matrix
object, if obj
is a matrix.
Nikita Platonov platonov@sevin.ru
temporal_mean
session_grid(NULL)
n <- 45 # bands
m <- 3 # sample size
k <- median(seq(n))+seq(m)-(m %/% 2)-1 ## sample subset
s <- 5 # window size
a <- round(ursa_dummy(n,min=-60,max=60,elements=15,mul=1/8))
a[a<(-40)] <- NA
b <- temporal_interpolate(a,7)
p1 <- colorize(a,lazy=TRUE)
p2 <- colorize(b,lazy=TRUE,colortable=p1)
display(list('Source'=p1[k],'Gaps are filled'=p2[k]),layout=c(2,NA)
,legend=list(list(1,"right"),list(2,"right")),decor=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.