classRaster_GroupGeneric: Group Generic Functions for raster image

groupGenericR Documentation

Group Generic Functions for raster image

Description

These functions implement arithmetical and logical operations, mathematical functions for objects of class ursaRaster as well as group generic functions from package base do similar for S3 class. These are local operations in the raster algebra (map algebra).

Usage

## S3 method for class 'ursaRaster'
Ops(e1, e2 = NULL)

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

## S3 method for class 'ursaRaster'
Complex(z)

## S3 method for class 'ursaRaster'
Summary(..., na.rm = FALSE)

Arguments

x

ursaRaster object

e1

ursaRaster object

e2

Numeric of length 1, matrix, array, or ursaRaster object.

na.rm

Logical. If na.rm=TRUE then no-data values are omitted.

z

Any.

...

For group Math - further arguments passed to methods. See description for generic.

For group Summary - set of arguments, which are recognized via their names (using regular expressions), position and classes.

.*

Position 1. Object of class ursaRaster.

cov|cvr

Position >1. Numeric between 0 and 1. If proportion of bands with no data for given location exceeds cover then output value is NA (no data). Default is 0.5-1e-3.

w

Position >1. Numeric of length number of bands or NULL. Band weights for weighted mean. Default is NULL; all bands have equal weights.

name

Position >1. Character of length 1. Band name for output raster. Default is ""; band name is assigned automatically.

verb(ose)*

Position >1. Logical. verbose=TRUE provides some additional information on console. Default is FALSE.

Details

The groups are ⁠'Summary'⁠, ⁠'Ops'⁠, ⁠'Math'⁠, and ⁠'Complex⁠'. See “Details” section in the S3 Generic Functions help page.

The group ⁠'Complex'⁠ is unsupported.

The groups ⁠'Math'⁠ and ⁠'Summary'⁠ are implemented completely.

The group ⁠'Ops'⁠ has some features.

  • Logical operators ⁠"<"⁠, ⁠">"⁠, ⁠"<="⁠, ⁠">="⁠, ⁠"=="⁠, ⁠\"!="⁠ return 'NA' for value FALSE and '1' for value TRUE to organize cells' masking.

  • Unary operator ⁠"!"⁠ is equal to binary operator operators ⁠"!="⁠, where the second argument is scalar value 0 (zero).

The operators of groups ⁠'Math'⁠ and ⁠'Ops'⁠ destroy color tables.

For group ⁠'Summary'⁠ the realization of local operators of map algebra is possible via apply function:
apply(ursa_value(obj),1,function(x) {y <- sd(x)+1;y})
or
as.ursa(apply(obj,1:2,function(x) {y <- sd(x)+1;y}))

Value

Operators of groups ⁠'Complex'⁠ return stop
Operators of groups ⁠'Math'⁠, ⁠'Ops'⁠, ⁠'Summary'⁠ return object of class ursaRaster

Author(s)

Nikita Platonov platonov@sevin.ru

See Also

Other S3 generic function for local operations of map algebra are mean, median.
Standard deviation (local) and certain local operations can be extracted using local_stat.

Examples

session_grid(NULL)
session_grid(regrid(mul=1/4))
a1 <- ursa_dummy(nband=3,min=-5*pi,max=5*pi)
print(a1)

try(print(complex1 <- Re(a1)))

print(math1 <- a2 <- round(a1))
print(math1 <- sin(a1))
print(math2 <- floor(a1))
print(math3 <- ceiling(a1))
print(math4 <- cumsum(a1)) ## does this have a sense for rasters?

print(ops1 <- a1-2*rev(a1)+mean(a1))
print(mean(ops1)) ## vanishing
a2 <- ursa_new(value=c(1,2,4),bandname=c("single","double","quadruple"))
print(a2)
print(ops2 <- a2[1]==a2[2])
print(ops3 <- a2[1]==a2[2]/2)
print(ops4 <- a1>0)
print(a1[a1>0])

print(sum1 <- sum(a1))
print(sum2 <- range(a1))

nplatonov/ursa documentation built on May 8, 2024, 6:02 p.m.