Learn R Programming

ursa (version 3.9.4)

blank: Does any band contain no information?

Description

Set of functions for checking is any or all bands have no data, and for retrieving indices for non-data bands.

Usage

band_blank(obj, ref = c("any", "0", "NA"), verbose = FALSE)

ursa_blank(obj, ref)

Arguments

obj

Object of class ursaRaster

ref

Character. Definition criteria, what is blank mean. If value "0", then blank is detected, if all values are 0. If value "NA", then blank is detected, if all values are NA. Default value is "NA": both NA and 0 are flags of blank. Non-character values are coerced to character.

verbose

Logical. Value TRUE provides progress bar. Default is FALSE.

Value

Function ursa_blank returns logical value of length 1.

Function band_blank returns logical value of length nband(obj).

Details

It is defined locally that if all values of band are NA or 0 (see description to argument ref), then such band is blank. The fact is ursa_new create new object in memory with default values NA, but create_envi writes zeros to disk quick. It is decided to consider both these cases as blank. Function band_blank checks blanks for each band of image. If all bands are blank then function ursa_blank returns TRUE.

See Also

is.na returns object of class ursaRaster; it is mask of cells, which have NA value.

Examples

Run this code
# NOT RUN {
session_grid(NULL)
a <- ursa_new(bandname=c("first","second","third","fourth"))
ursa_value(a,"first") <- 0 ## 'a[1] <- 1' works, but it is slow
print(ursa_blank(a))
a[3] <- pixelsize()
a[4] <- a[3]>625
print(a)
print(band_blank(a))
print(which(band_blank(a)))
print(ursa_blank(a))
# }

Run the code above in your browser using DataLab