Areas with the given category are eroded and their pixels value is replaced with the values given by the mode of the surrounding pixels.
r.fill.category iteratively applies r.neighbors and r.mapcalc until no pixel of the category to replace is left or the maximum number of iterations is reached.
Optionally, r.fill.category can create an MPEG file animating the replacement process.
The neighborhood size controls the size of the moving window where the mode of the values is used to assign a value to the pixels of the category to be replaced. Large values of the neighborhood size can speed the process considerably but can also lead to unwanted effects where pixels with the category to remove are mixed with pixels with different categories. Small values of neighborhood size require a large number of iterations, therefore longer processing times, but provide better results when categories are mixed.
The maximum number of iterations is limited to 999 because the name of the temporary map at each step uses three digit to identify the iteration.
The quality (1-5) parameter controls the quality of the MPEG, lower values will yield higher quality images, but with less compression (i.e. larger MPEG file size). Switching from quality=1 to quality=5 reduces the MPEG file size of about 40%, although the actual compression ratio depends on the number of frames.
The module r.out.mpeg is used to generate the MPEG file, therefore the program mpeg_encode (aka ppmtompeg) must be available. See r.out.mpeg manual for more information.
If a name for an MPEG output file is provided but the k flag is not set, intermediate maps are kept during the process and deleted after the MPEG file has been created.
# set the region on the landuse map g.region rast=landuse@PERMANENT # replace pixels of category 6 (water) with values of the surrounding pixels # create a drought.mpg animation file in the current directory r.fill.category input=landuse@PERMANENT output=landuse_dry category=6 animationfile=./drought.mpg
Available at: r.fill.category source code (history)
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
© 2003-2020 GRASS Development Team, GRASS GIS 7.8.3dev Reference Manual