Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running

r.neighbors --overwrite --verbose input=bf03pits@PERMANENT output=bf03pitsdenoise method=mode size=5

in the GRASS GUI using the r.neighbors dialog.

bf03pits has 3955848 all with values either 0 or 1.

When I run r.neighbors the result has 1 cell with a range of -nan to -nan.

Yet the output shows no errors.

Why might r.neighbors be failing? How can I go about doing what I want?

share|improve this question
Have you set the region to match your input raster? i.e. g.region rast=bf03pits – si_2012 Mar 15 '13 at 1:00
@si_2012, that was absolutely the problem. Please write your comment up as an answer so I can accept it. Was there some obvious way I should have known that? – Richard Mar 15 '13 at 4:30
Answer written up. There's no obvious way to know this, but with Grass its essential to pay close attention to the region settings. Before running commands, type g.region -p in the command line to make sure the settings are as you expect. – si_2012 Mar 15 '13 at 9:07
up vote 3 down vote accepted

In Grass, this sort of problem occurs when the region settings don't match the input raster. Try setting the region to the input raster, i.e. g.region rast=bf03pits, before running r.neighbors.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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