ursa_new: Create raster image in memory

ursa_newR Documentation

Create raster image in memory

Description

ursa_new creates object of class ursaRaster in memory using session grid parameters or properties of input object (matrix or array). By option, band names and ignore values are specified.

Usage

ursa_new(...)

Arguments

...

Set of arguments, which are recognized via their names (using regular expressions) and classes:

value

Pattern is "(|^value)". Admissible classes are (matrix, array,numeric,logical. Values to fill image. Array or matrix defines raster grid. If value=FALSE (logical), then created raster image has no values. By default, value=NA, the created raster image is filled by blank values (NA).

nband

Positive integer. Number of bands. Default is 1L.

bandname

Character. Band names. Default is NULL. If specified, then nband is ignored, and the number of bands is equal to length of bandname character vector.

ignorevalue

Integer or numeric. Value in ENVI binary file, which is interpretted as NA in R.

datatype

Positive integer c(1L, 2L, 3L, 4L, 5L, 11L, 12L, 13L) or character. Data type (integer, floating-point) and byte length. See details for argument datatype of function create_envi. Required for writing raster to ENVI binart file. Optional for rasters in memory. Default is NA: data type is defined internally.

colortable

Object of class ursaColorTable. Color table for raster. Default is NULL: color table is absent

permute

Logical. Should dimensions of input matrix be changed. Default is FALSE.

flip

Logical. Vertical flip for input matrix. Default is FALSE: no flip.

crs

Character or object of class ursaGrid. The reference grid for raster's cells. Default is NULL: the grid is defined ether from matrix/array structure or from sessional parameters.

verb(ose)*

Logical. Value TRUE may provide some additional information on console. Default is FALSE.

Details

ursa_new creates ursaRaster object in memory. To manipulate with raster chunks use the followed construction:

a <- create_envi(fname,...)
a[condition_1] <- value
print(a[condition_2]
...
close(a)

ursa_new is designed to create blank raster images. Use as.ursa for conversion R objects to ursaRaster.

Value

Object of class ursaRaster.

Author(s)

Nikita Platonov platonov@sevin.ru

See Also

as.ursa, create_envi.

Examples

session_grid(NULL)
a1 <- ursa_new(volcano)
print(a1)
 ## to avoid over-timing during tests -- begin
   display(a1)
 ## to avoid over-timing during tests -- end

a2 <- ursa_new(volcano,flip=TRUE)
print(a2)
 ## to avoid over-timing during tests -- begin
   display(a2)
 ## to avoid over-timing during tests -- end

a3 <- ursa_new(volcano,permute=TRUE)
print(a3)
 ## to avoid over-timing during tests -- begin
   display(a3)
 ## to avoid over-timing during tests -- end

dima <- c(200,300,4)
b1 <- as.ursa(array(runif(prod(dima)),dim=dima))
print(b1)
display_brick(b1,scale=1,pal=c("white","black"),decor=FALSE)

session_grid(NULL)

c1 <- ursa_new(seq(3))
print(c1)
c2 <- ursa_new(seq(3),bands=3)
print(c2)

c3 <- ursa_new(value=FALSE)
str(ursa_value(c3))

c4 <- ursa_new(bands=2,nodata=-99L)
print(c4)
print(ignorevalue(c4))

c5 <- ursa_new(bandname=format(Sys.Date()+seq(7)-1,"%A"))
ursa_value(c5) <- rev(seq(nband(c5)))
c5 <- colorize(c5)
ct <- ursa_colortable(c5)
print(c5)

v <- ursa_value(c5[3:5])
str(v)
v <- c(v)
str(v)
c6 <- ursa_new(v,colortable=ct)
print(c6)
print(ursa_colortable(c6))

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