Ops.band_stat: Computes statistics for each band of raster.

band_statR Documentation

Computes statistics for each band of raster.

Description

For each band of ursaRaster object, band_stat returns certain statistics (mean, sd, sum, min, max, number of non-NA pixels, number of NA pixels). Regarding to each band, it is global operations of map algebra.

Usage

band_stat(x, grid = FALSE, raw = FALSE)

Arguments

x

Object of class ursaRaster.

grid

Logical. If TRUE then metadata are returned instead of statistics. Default is FALSE

raw

Logical. For the case of raster values are categories, if raw=TRUE, then function returns statistics of categories; if raw=FALSE and names of categories can be transformed to numerical values, then function returns statistics for decategorized values. Default is FALSE.

Details

If raster values are not in memory or grid=TRUE then ursa_info is returned.

Generic function print for object of class ursaRaster uses returned value of band_stat function with formatted columns.

Statistics is computed for omitted NA values.

Value

data.frame. Row names are indices of bands. Column names are:

name

Band name.

mean

Mean value.

sd

Value of standard deviation with n-1 denomination.

sum

Sum of values.

min

Minimal value.

min

Maximal value.

n

Number of non-NA pixels.

nNA

Number of NA pixels.

Author(s)

Nikita Platonov platonov@sevin.ru

See Also

Columns extraction from returned data frame is in the group of band.* functions.

Examples

session_grid(NULL)
s <- substr(as.character(sessionInfo()),1,48)
a <- reclass(ursa_dummy(mul=1/2,bandname=s),ramp=FALSE)
band_stat(a,grid=TRUE)
b2 <- band_stat(a)
b3 <- band_stat(a,raw=TRUE)
str(b2)
str(b3)
print(b2)
print(a) ## 'print.ursaRaster' uses 'band_stat'
print(a,raw=TRUE)

ursa documentation built on Sept. 30, 2024, 9:35 a.m.