Skip to content

r3.count.categories

Count categories in vertical direction

r3.count.categories [-ds] input=name output=basename slices=basename [multiply=float] [add=float] [size=integer] [surface=name] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

r3.count.categories input=name output=basename slices=basename

grass.script.run_command("r3.count.categories", input, output, slices, multiply=None, add=None, size=None, surface=None, flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("r3.count.categories", input="name", output="basename", slices="basename")

Parameters

input=name [required]
    Name of input 3D raster map
output=basename [required]
    Name for output basename raster map(s)
slices=basename [required]
    Basename for horizontal slices of the 3D raster
    Name for output basename raster map(s)
multiply=float
    Value to multiply the raster values with
    Coefficient a in the equation y = ax + b
add=float
    Value to add to the raster values
    Coefficient b in the equation y = ax + b
size=integer
    Moving window size
    By default, only the given cell is considered
surface=name
    Count only those cells which are under the surface (in cells)
-d
    Divide count by the number of cells in the surface
-s
    Expect the slices to be already present
    When running the module over and over, this saves the slicing 3D raster step
--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 3D raster map
    Used as: input, raster_3d, name
output : str, required
    Name for output basename raster map(s)
    Used as: output, raster, basename
slices : str, required
    Basename for horizontal slices of the 3D raster
    Name for output basename raster map(s)
    Used as: output, raster, basename
multiply : float, optional
    Value to multiply the raster values with
    Coefficient a in the equation y = ax + b
add : float, optional
    Value to add to the raster values
    Coefficient b in the equation y = ax + b
size : int, optional
    Moving window size
    By default, only the given cell is considered
surface : str, optional
    Count only those cells which are under the surface (in cells)
    Used as: input, raster, name
flags : str, optional
    Allowed values: d, s
    d
        Divide count by the number of cells in the surface
    s
        Expect the slices to be already present
        When running the module over and over, this saves the slicing 3D raster step
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

r3.count.categories iterates over whole numbers (categories, classes) in the 3D raster (considers values to be integers) and for each vertical column counts them in the given column.

The 3D raster map is considered to be integer, i.e. all values are converted to integer values with truncation. When some conversion is appropriate the multiply option can be used to scale the value before conversion. For example, if the values are percentages with values between 0 and 1, value 100 can be used to obtain percentages between 0 and 100. The values will be then preserved with precision 1 (decimal part is truncated).

SEE ALSO

r3.to.rast, r3.to.group (addon), r3.what

AUTHOR

Vaclav Petras, NCSU GeoForAll Lab

SOURCE CODE

Available at: r3.count.categories source code (history)
Latest change: Thursday Feb 20 13:02:26 2025 in commit 53de819