Last chance! 50% off unlimited learning
Sale ends in
Set of functions for checking is any or all bands have no data, and for retrieving indices for non-data bands.
band_blank(obj, ref = c("any", "0", "NA"), verbose = FALSE)
ursa_blank(obj, ref)
Function ursa_blank
returns logical value of length 1.
Function band_blank
returns logical value of length nband(obj)
.
Object of class ursaRaster
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.
Logical. Value TRUE
provides progress bar. Default is FALSE
.
Nikita Platonov platonov@sev-in.ru
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
.
is.na
returns object of class ursaRaster
; it is mask of cells, which have NA
value.
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