classStack: List of raster images.

ursaStackR Documentation

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 class 'ursaRaster'
as.list(x, ...)

## S3 method for class '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
Arguments "...", which are passed to function lapply.

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.

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.

Note

Generic unlist(x) deals only with class of x, but doesn't take into account class of objects in list (e. g., x[[1]]). So, there is no effective way to use only list/unlist for ursaRaster objects to do a conversion between raster brick and stack. Generic unlist(x) deals only with class of x, but doesn't take into account class of objects in list (e. g., x[[1]]). So, there is no effective way to use only list/unlist for ursaRaster objects to do a conversion between raster brick and stack.

Author(s)

Nikita Platonov

References

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

See Also

lapply list unlist

c for ursaRaster objects.

Examples

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")

ursa documentation built on March 18, 2022, 6:23 p.m.