Function used to facilitate retrieval useful info from a raster object or file.
get_rastinfo(in_rast, stats = FALSE, quantiles = FALSE, hist = FALSE, verbose = TRUE)
in_rast | a |
---|---|
stats |
|
quantiles |
|
hist |
|
verbose | if FALSE suppress messages |
list
containing the following object:
nbands: numeric
Number of bands of the object/file;
indbands: numeric
If the object is associated with a file on disk, bands of the
file to which each layer of the object correspond (see examples);
ncols: numeric
Number of columns;
nrows: numeric
Number of rows;
ncells: numeric
Number of cells;
bnames: character
Band names;
fnames: character
If the object is associated with one or more files on disk,
filename(s) corresponding to the different bands;
Z: ANY
if the object has a "z" attribute set using raster::setZ(), values of the
z attribute;
dtype: character
datatype of the input raster (raster
conventions)
proj4string: character
proj4string of the object/file
units: character
distance units of the projections
According to settings on stats
, quantiles
and hist
, the following
info are also reported:
stats: data.frame
containing min, max, average and standard deviation
for each band (see examples);
quants: data.frame
containing the quantiles of the distribution
of raster values, for each band (100 value - 0.01 interval) (NULL is returned
if quants
== FALSE (the default));
hists: data.frame
containing information about the distribution of
raster values for each band. the data frame includes the limits of each
bin, the count of the number of pixels included in it, the corresponding
frequency and the cumulated frequency at each bin (NULL is returned
if hists
== FALSE (the default));
in_rast <- system.file("extdata/OLI_test", "oli_multi_1000.tif", package = "sprawl.data") get_rastinfo(in_rast)#>#> $nbands #> [1] 6 #> #> $indbands #> [1] 1 2 3 4 5 6 #> #> $ncols #> [1] 980 #> #> $nrows #> [1] 993 #> #> $ncells #> [1] 973140 #> #> $res #> [1] 30 30 #> #> $bnames #> [1] "oli_multi_1000.1" "oli_multi_1000.2" "oli_multi_1000.3" "oli_multi_1000.4" #> [5] "oli_multi_1000.5" "oli_multi_1000.6" #> #> $fnames #> [1] "/home/lb/R/x86_64-pc-linux-gnu-library/3.5/sprawl.data/extdata/OLI_test/oli_multi_1000.tif" #> #> $Z #> list() #> #> $dtype #> [1] "FLT8S" #> #> $proj4string #> [1] "+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0" #> #> $units #> [1] "m" #>in_rast <- system.file("extdata/OLI_test", "oli_multi_1000_b1.tif", package = "sprawl.data") get_rastinfo(in_rast)#>#> $nbands #> [1] 1 #> #> $indbands #> [1] 1 #> #> $ncols #> [1] 980 #> #> $nrows #> [1] 993 #> #> $ncells #> [1] 973140 #> #> $res #> [1] 30 30 #> #> $bnames #> [1] "oli_multi_1000_b1" #> #> $fnames #> [1] "/home/lb/R/x86_64-pc-linux-gnu-library/3.5/sprawl.data/extdata/OLI_test/oli_multi_1000_b1.tif" #> #> $Z #> list() #> #> $dtype #> [1] "FLT8S" #> #> $proj4string #> [1] "+proj=utm +zone=32 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0" #> #> $units #> [1] "m" #>