groupGeneric {ursa} | R 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 |
|
e1 |
|
e2 |
Numeric of length 1, matrix, array, or |
na.rm |
Logical. If |
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.
|
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 valueFALSE
and'1'
for valueTRUE
to organize cells' masking.Unary operator
"!"
is equal to binary operator operators"!="
, where the second argument is scalar value0
(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))