r.diversity
Calculate diversity indices based on a moving window using r.li packages
r.diversity [-t] input=name prefix=name [alpha=alpha value for Renyi entropy [,alpha value for Renyi entropy,...]] [size=moving window [,moving window,...]] [method=method [,method,...]] [exclude=exclude method [,exclude method,...]] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]
Example:
r.diversity input=name prefix=name
grass.script.run_command("r.diversity", input, prefix, alpha=None, size=3, method="simpson,shannon,pielou,renyi", exclude=None, flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)
Example:
gs.run_command("r.diversity", input="name", prefix="name")
Parameters
input=name [required]
Name of input raster map
prefix=name [required]
Prefix for output raster map(s)
alpha=alpha value for Renyi entropy [,alpha value for Renyi entropy,...]
Order of generalized entropy (> 0.0; undefined for 1.0)
size=moving window [,moving window,...]
Size of processing window (odd number only)
Default: 3
method=method [,method,...]
Name of methods to use
Allowed values: simpson, shannon, pielou, renyi
Default: simpson,shannon,pielou,renyi
exclude=exclude method [,exclude method,...]
Exclude methods
Allowed values: simpson, shannon, pielou, renyi
-t
Preserve configuration files
--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--qq
Very quiet module output
--ui
Force launching GUI dialog
input : str, required
Name of input raster map
Used as: input, raster, name
prefix : str, required
Prefix for output raster map(s)
Used as: output, raster, name
alpha : float | list[float] | str, optional
Order of generalized entropy (> 0.0; undefined for 1.0)
Used as: alpha value for Renyi entropy
size : int | list[int] | str, optional
Size of processing window (odd number only)
Used as: moving window
Default: 3
method : str | list[str], optional
Name of methods to use
Used as: method
Allowed values: simpson, shannon, pielou, renyi
Default: simpson,shannon,pielou,renyi
exclude : str | list[str], optional
Exclude methods
Used as: exclude method
Allowed values: simpson, shannon, pielou, renyi
flags : str, optional
Allowed values: t
t
Preserve configuration files
overwrite: bool, optional
Allow output files to overwrite existing files
Default: False
verbose: bool, optional
Verbose module output
Default: False
quiet: bool, optional
Quiet module output
Default: False
superquiet: bool, optional
Very quiet module output
Default: False
DESCRIPTION
r.diversity calculates selected diversity indices by calling various r.li commands.
This script uses the Pielou, Renyi, Shannon and Simpson indices. The output is a map for each index.
NOTES
The user does not need to create a "conf" file with r.li.setup because
this file will be created automatically by the script.
In size option it is possible use more values: the user can set more
values with comma (,) and a range with minus (-).
If you calculate Renyi entropy remember to add the alpha option.
Alpha option support single and multi values but not a range.
If the input raster contains NULL value cells, r.diversity returns -1
for these cells.
If the user wants to keep NULL values instead, run subsequently on the
resulting map:
r.null map=my_map setnull=-1
EXAMPLES
To calculate the set of indices from a NDVI map, with a moving window of 3 x 3 pixel, run:
r.diversity input=ndvi_map prefix=diversity alpha=0.5
To calculate the set of indices from a NDVI map, with a moving window of 7 x 7 pixel, run:
r.diversity input=ndvi_map prefix=diversity alpha=0.5 size=7
To calculate only Pielou and Simpson indices from a NDVI map, with several moving window (3 x 3, 5 x 5, 7 x 7, 9 x 9), run:
r.diversity input=ndvi_map prefix=diversity size=3-9 method=pielou,simpson
To calculate all methods excluding Pielou from a NDVI map, with two moving window (3 x 3, 9 x 9), run:
r.diversity input=ndvi_map prefix=diversity size=3,9 exclude=pielou alpha=3
SEE ALSO
r.li, r.li.pielou, r.li.renyi, r.li.shannon, r.li.simpson
AUTHORS
Luca Delucchi and Duccio Rocchini, Fondazione E. Mach (Italy)
SOURCE CODE
Available at: r.diversity source code
(history)
Latest change: Thursday Feb 20 13:02:26 2025 in commit 53de819