Ops.global_group: Extract certains statistics for whole image

Description Usage Arguments Details Value Author(s) Examples

Description

Function from this global.\emph{FUN} list returns requred statistics FUN for the whole image.

Usage

1
2
3
4
5
6
7
8
9

Arguments

x

Object of class ursaRaster.

ursa

Logical. The class of returned value. If FALSE then numeric vector of length one is returned (for global_range vector has length two). If TRUE then returned value is single-band raster image (two-bands image for global_range) with constant value for all cells (blank image). Default is FALSE.

...

Arguments in function global.\emph{FUN} which are passed to function \emph{FUN}.

Details

For any function global.\emph{FUN}, if argument na.rm is not in ..., then \emph{FUN} is called with forced na.rm=TRUE.

global_range\emph{list of arguments} is implemented as c(global_min(\emph{list of arguments}), global_max(\emph{list of arguments})) with the same list of arguments.

Alternative method to get global statistics is function applying directly to the raster value. For example, sd(ursa_value(x,na.rm=TRUE)). This way is also appropriate for missing global functions: for example, var(ursa_value(x,na.rm=TRUE)).

Value

If ursa=FALSE then numeric.
If ursa=TRUE then object of class ursaRaster.

Author(s)

Nikita Platonov platonov@sevin.ru

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
session_grid(NULL)
a <- ursa_dummy(2,min=-40,max=80)
a[a<0] <- NA
print(a)
a.mean <- global_mean(a)
a.sd <- global_sd(a)
a.sum <- global_sum(a)
a.min <- global_min(a)
a.max <- global_max(a)
a.median <- global_median(a)
print(c(mean=a.mean,sd=a.sd,sum=a.sum,min=a.min,max=a.max,median=a.median))
v.max <- max(ursa_value(a),na.rm=TRUE)
print(c('global_max()'=a.max,'max(ursa_value())'=v.max,dif=a.max-v.max))
r.max <- global_max(a,ursa=TRUE)
print(r.max)
b <- c(a,'appended scalar value'=a.max)
print(b)

ursa documentation built on Feb. 26, 2020, 3:01 p.m.