Learn R Programming

ursa (version 3.9.4)

ursaValue: Values of raster images.

Description

Class ursaValue is a part of class ursaRaster. It contains values of image. In the case of numeric values, the exterior class is ursaNumeric. In the case of categorical values, the exterior class is ursaCategory.

Usage

# S3 method for ursaCategory
print(x, ...)

# S3 method for ursaNumeric print(x, ...)

ursa_value(obj, band) ursa_value(obj, band) <- value

Arguments

x

Object of the one of classes ursaNumeric or ursaCategory

Further arguments passed to generic functions print and str.

obj

Object of class ursaRaster

band

Optional. Vector of band numbers (positive integer) or band names (character).

value

Numeric or integer scalar, vector, or matrix. Coerced to dimenstion of ursaValue.

Value

Object of class ursaNumeric is a numerical matrix. Object of class ursaCategory is an integer matrix. Dimensions of this matrix:

dim(…)[1]

Spatial domain; the length is muliplications of lines (rows) and samples (columns)

dim(…)[2]

Band or temporal domain; the length is number of bands

It is allowed to use scalar value NA in the case when values are not in memory. In this case the class is ursaValue.

Details

Try to use high-level assignment using replacement [<- operator for class ursaRaster. However, if you don't get desired result, you can downgrade the level of your code.

See Also

Extract [ and replacement [<- methods for class ursaRaster

Examples

Run this code
# NOT RUN {
session_grid(NULL)
session_grid(regrid(mul=1/4))
a1 <- create_envi("exam1.envi",bandname=c("today","tomorrow"))
str(ursa_value(a1))
close(a1)
envi_remove("exam1")
a2 <- ursa_dummy(nband=4,min=1,max=99)
str(ursa_value(a2),digits=3)
a3 <- as.integer(a2)
str(ursa_value(a3))
str(ursa_value(a3,2))
print(ursa_value(a3))
print(a3)
ursa_value(a3,"Band 2") <- 199
ursa_value(a3)[,3] <- 299
a3[4] <- 399
print(a3)
ursa_value(a3[1:3]) <- ursa_value(a3[4])
print(a3)
ursa_value(a3[1:3]) <- -c(1:3)
print(a3)
# }

Run the code above in your browser using DataLab