r.reclass.area
Reclasses a raster map greater or less than user specified area size (in hectares).
r.reclass.area [-cdimv] input=name output=name [value=float] [mode=string] [lower=float] [upper=float] [method=string] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]
Example:
r.reclass.area input=name output=name lower=0.0
grass.tools.Tools.r_reclass_area(input, output, value=None, mode=None, lower=None, upper=None, method="reclass", flags=None, overwrite=None, verbose=None, quiet=None, superquiet=None)
Example:
tools = Tools()
tools.r_reclass_area(input="name", output="name", lower=0.0)
This grass.tools API is experimental in version 8.5 and expected to be stable in version 8.6.
grass.script.run_command("r.reclass.area", input, output, value=None, mode=None, lower=None, upper=None, method="reclass", flags=None, overwrite=None, verbose=None, quiet=None, superquiet=None)
Example:
gs.run_command("r.reclass.area", input="name", output="name", lower=0.0)
Parameters
input=name [required]
Name of input raster map
output=name [required]
Name for output raster map
value=float
Value option that sets the area size limit (in hectares) (deprecated)
mode=string
Keep only areas lesser or greater than specified value (deprecated)
Allowed values: lesser, greater
lower=float
Value for the lower area size limit (in hectares). Pixel clumps with areas below this value are removed.
upper=float
Value for the upper area size limit (in hectares). Pixel clumps with areas above this value are removed.
method=string
Method used for area size filtering
Allowed values: reclass, rmarea
Default: reclass
-c
Input map is clumped
-d
Generate clumps including diagonal neighbors
-i
Invert filter (remove clumps larger than lower and smaller than upper)
-m
Apply lower area threshold as "minsize" during clumping
-v
Output vector map, do not convert back to raster (only for method 'rmarea')
--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 | np.ndarray, required
Name of input raster map
Used as: input, raster, name
output : str | type(np.ndarray) | type(np.array) | type(gs.array.array), required
Name for output raster map
Used as: output, raster, name
value : float, optional
Value option that sets the area size limit (in hectares) (deprecated)
mode : str, optional
Keep only areas lesser or greater than specified value (deprecated)
Allowed values: lesser, greater
lower : float, optional
Value for the lower area size limit (in hectares). Pixel clumps with areas below this value are removed.
upper : float, optional
Value for the upper area size limit (in hectares). Pixel clumps with areas above this value are removed.
method : str, optional
Method used for area size filtering
Allowed values: reclass, rmarea
Default: reclass
flags : str, optional
Allowed values: c, d, i, m, v
c
Input map is clumped
d
Generate clumps including diagonal neighbors
i
Invert filter (remove clumps larger than lower and smaller than upper)
m
Apply lower area threshold as "minsize" during clumping
v
Output vector map, do not convert back to raster (only for method 'rmarea')
overwrite : bool, optional
Allow output files to overwrite existing files
Default: None
verbose : bool, optional
Verbose module output
Default: None
quiet : bool, optional
Quiet module output
Default: None
superquiet : bool, optional
Very quiet module output
Default: None
Returns:
result : grass.tools.support.ToolResult | np.ndarray | tuple[np.ndarray] | None
If the tool produces text as standard output, a ToolResult object will be returned. Otherwise, None will be returned. If an array type (e.g., np.ndarray) is used for one of the raster outputs, the result will be an array and will have the shape corresponding to the computational region. If an array type is used for more than one raster output, the result will be a tuple of arrays.
Raises:
grass.tools.ToolError: When the tool ended with an error.
input : str, required
Name of input raster map
Used as: input, raster, name
output : str, required
Name for output raster map
Used as: output, raster, name
value : float, optional
Value option that sets the area size limit (in hectares) (deprecated)
mode : str, optional
Keep only areas lesser or greater than specified value (deprecated)
Allowed values: lesser, greater
lower : float, optional
Value for the lower area size limit (in hectares). Pixel clumps with areas below this value are removed.
upper : float, optional
Value for the upper area size limit (in hectares). Pixel clumps with areas above this value are removed.
method : str, optional
Method used for area size filtering
Allowed values: reclass, rmarea
Default: reclass
flags : str, optional
Allowed values: c, d, i, m, v
c
Input map is clumped
d
Generate clumps including diagonal neighbors
i
Invert filter (remove clumps larger than lower and smaller than upper)
m
Apply lower area threshold as "minsize" during clumping
v
Output vector map, do not convert back to raster (only for method 'rmarea')
overwrite : bool, optional
Allow output files to overwrite existing files
Default: None
verbose : bool, optional
Verbose module output
Default: None
quiet : bool, optional
Quiet module output
Default: None
superquiet : bool, optional
Very quiet module output
Default: None
DESCRIPTION
r.reclass.area removes areas (pixel clumps) from a raster map that are smaller than a user specified lower area size and/or greater than a user-specified upper threshold (both in hectares).
r.reclass.area provides two methods for filtering:
- reclass - raster-based filtering
- rmarea - vector-based filtering
With the reclass method, the input raster map is clumped and then reclassified using the clump size. With the -m flag, reclass method will remove small areas already during clumping, using the minsize option there. If the -c flag is used, r.reclass.area will skip the creation of a clumped raster and assume that the input raster map is already clumped.
The rmarea method converts the raster map to vector and removes areas outside the given thresholds using v.clean and v.edit. With the -v flag the output is the filtered vector map instead of a raster.
EXAMPLES
In this example, the ZIP code map in the North Carolina sample dataset is filtered for large areas (removing smaller areas from the map).
g.region raster=zipcodes -p
r.report zipcodes unit=h
Extract only areas greater than 2000 ha, NULL otherwise:
r.reclass.area input=zipcodes output=zipcodes_larger2000ha greater=2000
r.report zipcodes_larger2000ha unit=h

Figure: r.reclass.area method=reclass
In this example, the ZIP code map in the North Carolina sample dataset is filtered for smaller areas which are substituted with the value of the respective adjacent area with largest shared boundary. Reclass by substitutional removing of areas smaller than 1000 ha:
r.reclass.area input=zipcodes output=zipcodes_minor1000ha lesser=1000 method=rmarea

Figure: r.reclass.area method=rmarea
SEE ALSO
r.clump, r.reclass, r.stats, v.to.rast, v.clean, v.edit
AUTHORS
NRCS,
Markus Neteler
Stefan Blumentath
SOURCE CODE
Available at: r.reclass.area source code
(history)
Latest change: Monday Jul 13 14:33:46 2026 in commit 2e02066