Learn R Programming

ursa (version 3.9.4)

ursa: Get and set properties of raster image.

Description

For package description see.

ursa is a wrapper to initialize object of class ursaRaster, to get and to set properties for this object.

Usage

ursa(obj, attr, ...)
ursa(obj, attr, ...) <- value

Arguments

obj

Any numeric structure (scalar, matrix, array) for initializing. Object of class ursaRaster for extracting and assigning properties.

attr

Character. Name of property.

Arguments, which are passed for properties specification.

value

Value for property assignment.

Value

Inititalizing function ursa (missing attr) returns object of class ursaRaster.

Extract function ursa returns object of respective property.

Replace function ursa<- returns object

Details

Initializing function ursa with missing argument attr is a wrapper for function as.ursa.

Matched pattern Replace method? Description of property Implementation
"grid" Yes Raster grid (extent, projection, cellsize) ursa_grid
"(proj|crs)" Yes Coordinate reference system ursa_proj
"val" Yes Raster value in the internal storage format ursa_value
"(colort|ct)" Yes Color table ursa_colortable
"(categ|class)" Yes Names of categories names(ursa_colortable(obj))
"name" Yes Band names names
"(nodata|ignorevalue|bg)" Yes Value, which is interpreted as NA. ignorevalue
"^table$" No Frequency of unique values as.table
"cell" No Squared cell size with(ursa_grid(obj),sqrt(resx*resy))
"^dim$" No Dimension of raster image dim
"(extent|bbox)" No Spatial extent of raster image with(ursa_grid(obj),c(xmin=minx,ymin=miny,xmax=maxx,ymax=maxy))
"(nrow|rows|lines)" No Number of rows of raster image ursa_grid(obj)$rows
"(ncol|columns|samples)" No Number of columns of raster image ursa_grid(obj)$columns
"con" No structure of connection obj$con
"(info|meta(data)*)" No Metadata, brief info ursa_info

Argument … is used to specify band index or band pattern in ursa(obj,"value",...)

See Also

as.ursa

Examples

Run this code
# NOT RUN {
a1 <- ursa(volcano)
print(a1)
display(a1)

a2 <- ursa(volcano,flip=TRUE)
print(a2)
display(a2)

a3 <- ursa(volcano,permute=TRUE)
print(a3)
display(a3)

a4 <- ursa(volcano,flip=TRUE,permute=TRUE)
print(a4)
display(a4)

dima <- c(200,300,4)
b1 <- ursa(array(runif(prod(dima)),dim=dima))
print(b1)
display_brick(b1,scale=1,pal.rotate=0,pal.hue=0,decor=FALSE)

session_grid(NULL)

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

c3 <- ursa(value=FALSE)
str(ursa(c3,"value"))

c4 <- ursa(bands=2,nodata=-99L)
print(c4)
print(ursa(c4,"nodata"))

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

v <- ursa(c5[3:5],"value")
str(v)
v <- c(v)
str(v)
c6 <- ursa(v,colortable=ct)
print(c6)
print(ursa(c6,"colortable"))
# }

Run the code above in your browser using DataLab