Ops.local_group: Create single-band raster using statistics of multi-bands...

local_groupR Documentation

Create single-band raster using statistics of multi-bands raster.

Description

Local operations (mean value, sum of values, median, minimum, maximum) of map algebra for multi-bands ursaRaster object.

Usage

local_mean(x, cover = 0.5 - 1e-3, weight = NULL, verbose = FALSE, bandname = "mean")
local_sum(x, cover = 0.5 - 1e-3, weight = NULL, verbose = FALSE, bandname = "sum")
local_median(x, cover = 0.5 - 1e-3, verbose = FALSE)
local_min(x, cover = 0.5 - 1e-3, verbose = FALSE)
local_max(x, cover = 0.5 - 1e-3, verbose = FALSE)
local_sd(x, cover = 0.5 - 1e-3, verbose = FALSE)
local_var(x, cover = 0.5 - 1e-3, verbose = FALSE)
local_quantile(x, probs = seq(0, 1, 0.25), type = 7, cover = 0.5 - 1e-3, verbose = FALSE)

## S3 method for class 'ursaRaster'
mean(x, ...)

## S3 method for class 'ursaRaster'
median(x, ...)

## S3 method for class 'ursaRaster'
quantile(x, ...)

# non public
.average(x, cover = 0.5 - 1e-3, weight = NULL, sum = FALSE, verbose = FALSE)

Arguments

x

ursaRaster object. In function local_mean and local_sum it is allowed to specify array with 3 dimensions (col, row, band) or (row, col, band)

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 created map. If code>1 then number of bands. If 0<=cover<=1 then proportion cover to number of bands.

weight

Positive numeric of length equal to number of bands. For local_mean and local_sum only. If specified, then weighted mean or sum are applied. The prior normalization is not required.

sum

Logical. For .average only. If sum=TRUE then fuction returns sum of values else mean value.

probs

Numeric. For local_quantile only. Argument probs, which is passed as argument probs to generic function quantile().

type

Numeric. For local_quantile only. Argument type, which is passed as argument probs to generic function quantile().

verbose

Logical. If verbose=TRUE then some output appears in console. Used for debug and benchark.

bandname

Character. Band name for created single-band image.

...

Function mean - arguments, which are passed to local_mean().
Function median - arguments, which are passed to local_median().
Function quantile - arguments, which are passed to local_quantile().

Details

If for valid output cell value it is required to have at least m values not marked as NA, specify quota as cover=m/nband(x).

local_mean and local_sum are wrapper to non-public function .average.

Generic functions mean, median, sd for ursaRaster class are implemented via local_mean, local_median, local_sd, respectively.

Value

Double-band ursaRaster object for local_range().
Multi-band ursaRaster object for local_quantile().
Otherwise, single-band ursaRaster object.

Author(s)

Nikita Platonov platonov@sevin.ru

See Also

If bands are interpreted as time series, apply local_stat

Mean value for image brick global_mean

Mean value for each band band_mean

Examples

session_grid(NULL)
b <- ursa_dummy(nband=7,min=0,max=100,mul=1/16)
b[b<40] <- NA
print(b)
res <- c('mean'=mean(b),'local_mean'=local_mean(b)
        ,'sum0'=local_sum(b,cover=0),'sum1'=local_sum(b,cover=1))
print(res)

display(b)
display(res)


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