Learn R Programming

ursa (version 3.9.4)

ursaStack: List of raster images.

Description

Functions to create list (layers) of multiband raster images (stack in the notation of raster package) and to coerce list of images to single multiband image (brick in the notation of raster package).

Usage

ursa_stack(...)

ursa_brick(obj)

ursa_apply(obj, FUN, ...)

# S3 method for ursaRaster as.list(x, ...)

# S3 method for ursaStack unlist(x, recursive, use.names)

Arguments

obj, x

Object of class ursaRaster or list of ursaRaster objects. In function ursa_apply argument "X", which is passed to function lapply.

FUN

Argument "FUN", which is passed to function lapply.

recursive

Not used. For consistency with generic function unlist.

use.names

Not used. For consistency with generic function unlist.

Denending of functions:

ursa_stack, as.list
List of ursaRaster objects
ursa_apply

Value

ursa_stack, as.list return object of class ursaStack. It is a list, with class "ursaStack" attribute.

unlist (for list of ursaRaster objects), ursa_brick return object of class ursaRaster.

ursa_apply returns object of class ursaStack, if result is list of ursaRaster objects, otherwise returns general list.

Warning

There is no any verifications, that grids of ursaRaster objects are the same.

Details

as.list (of ursaRaster object(s)), ursa_stack create list of ursaRaster objects, where items of list are sinle-band images. If x is ursaRaster object, then list(x) create a list of length one, which item is multiband image.

unlist (for list of ursaRaster objects), ursa_brick create single multiband ursaRaster object. There is an alternative way for unlisting the list of ursaRaster: as.ursa.

Raster stack is a way to group bands, for example, by units (degree Celsium, meters). Raster brick is a way to combine versalite images to the single multiband image, for example, for saving in file.

References

https://CRAN.R-project.org/package=raster

See Also

lapply list unlist

c for ursaRaster objects.

Examples

Run this code
# NOT RUN {
session_grid(NULL)
a <- ursa_dummy(3)
print(a)
b1 <- ursa_stack(a[1:2],colorize(a[3],ramp=FALSE))
print(b1)
b2 <- as.list(a)
print(b2)
b3 <- list(a[1],a[2:3])
print(b3)
b31 <- lapply(b3,colorize,ramp=FALSE)
print(b31)
b32 <- ursa_apply(b3,colorize,ramp=FALSE,rev=TRUE)
print(b32)
s311 <- ursa_apply(b31,ursa_colortable)
print(s311)
s21 <- lapply(b2,global_mean)
print(s21)
s22 <- sapply(b2,global_mean)
print(s22)
s31 <- lapply(b3,global_mean)
print(s31)
s32 <- sapply(b3,global_mean)
print(s32)
c1 <- unlist(b1)
print(c1)
c2 <- unlist(b2)
print(c2)
c3 <- unlist(b3)
print(if (is.ursa(c3)) c3 else "broken object")
d3 <- as.ursa(b3)
print(if (is.ursa(d3)) d3 else "broken object")
# }

Run the code above in your browser using DataLab