After resampling a discrete raster I have floating point cell values at the catergory borders. Is there a tool similar to the GRASS tool r.neighbors that corrects these values to the most frequent values around this cell? NA should be ignored.

1 Answer 1


I think the problem may be that the raster is of type float.

You can call r.neighbours from QGIS using the processing toolkit, including the use of the "mode" algorithm. In QGIS 2.18.3, at least.

But looking at the documentation for r.neighbours, to quote one of the footnotes

[2] Calculating the mode of floating-point data is essentially meaningless. 

You might be able to get around this by converting your raster to an integer type, or maybe quantizing the data (reclassifying values into bands of values which are close enough to be considered identical)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.