Ops.local_stat: Bundle of statistics, which is applied to each cell of...

local_statR Documentation

Bundle of statistics, which is applied to each cell of multi-band image.

Description

If bands of ursaRaster object are interpreted as observations in time, then local_stat returns some parameters for time-series analysis. This is a local operation of map algebra.

Usage

local_stat(obj, time = NULL, cover = 1e-06, smooth = FALSE, verbose = FALSE)

Arguments

obj

Object of class ursaRaster

time

Numeric or NULL. If NULL then regression parameters are for regular time-series using position of band in the brick (or, time=seq(obj)). If numeric, then length of time should be equal to number of bands of obj, and time is used to set irregularity for time-series.

cover

Numeric. 0<=cover<=1 or >1. Quota for NA values in the location for all bands. Quota exceeding leads to recording NA value in the cell of created band. If code>1 then number of bands. If 0<=cover<=1 then proportion cover to number of bands. Default is 1e-6.

smooth

Logical. If TRUE then median focal smoothing is applying to created 'slope' band; it is more suitable for visualization. Default is FALSE.

verbose

Logical. Value TRUE provides some additional information on console. Default is FALSE.

Value

Object of class ursaRaster with bands:

mean

Mean value in each cell across all bands of source raster.

sd

Standard deviation in each cell across all bands of source raster. Denominator is n.

sum

Sum value in each cell across all bands of source raster.

min

Minimal value in each cell across all bands of source raster.

max

Maximal value in each cell across all bands of source raster.

n

Number of non-NA values in each cell across all bands of source raster (number of observations).

slope

Slope value in each cell across all bands of source raster.

slopeS

Significance of slope value taken with a sign of slope.

RSS

Resisual sum of squares.

ESS

Explained sum of squares.

Author(s)

Nikita Platonov platonov@sevin.ru

See Also

Local statistics of map algebra, Group generics for objects of class ursaRaster.

Examples

session_grid(NULL)
set.seed(353)
session_grid(regrid(mul=1/8))
a <- ursa_dummy(nband=15)
a[a<60] <- NA
cvr <- 12
b <- local_stat(a,cover=cvr)
print(b)
c.mean <- c('<bundle> mean'=b["mean"]
           ,'local_mean'=local_mean(a,cover=cvr)
           ,'<generic> mean'=mean(a,cover=cvr))
c.max <- c('<bundle> max'=b["max"]
          ,'local_max'=local_max(a,cover=cvr)
          ,'<generic> max'=max(a,cover=cvr))
print(c.mean)
print(c.max)
cmp <- c(mean=b["mean"]-local_mean(a,cover=cvr)
        ,sd=b["sd"]-local_sd(a,cover=cvr))
print(round(cmp,12))
d <- as.list(b)
d[["slopeS"]] <- colorize(d[["slopeS"]],stretch="signif")
display(d,blank.density=20,blank.angle=c(-45,45))

ursa documentation built on Dec. 28, 2022, 2:18 a.m.