[GRASS-user] Re: [GRASSLIST:1191] How to silence d.legend output?

Hamish hamish_nospam at yahoo.com
Mon Oct 9 23:36:27 EDT 2006

Jason Horn wrote:
> Hi all.  Does anyone know how to silence the output (in particular  
> warnings) of d.legend?  d.legend frequently gives the following
> warning:
> "WARNING: Color range exceeds upper limit of actual data".
> It also gives a system beep at the same time.  I am using d.legend in 
> a script that produces a time animated series of images wherein each  
> image has the same legend.  Naturally, not every image will have all  
> values in the range, which, I assume, is why I get the warning.   
> Redirecting the output to null does not work.  The warning messages  
> and beeps are driving me nuts! :)
> For reference, the d.legend command is as follows:
> d.legend map=some_raster color=white lines=0 thin=1 labelnum=5  
> at=75,10,93,95 use=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19  
> range=0,19

You need to redirect stderr to /dev/null, not stdout:

  d.legend map=some_raster range=0,19  2> /dev/null

It's been so long since I turned off the terminal bell that I can hardly
remember how, but, for rxvt put this in ~/.Xresources
rxvt*visualBell: True

for gnome-terminal it is somewhere in edit current profile config gui.

another very effective solution is to open your computer case and remove
the wire to the speaker. (!)

I put that warning in d.legend, and I would like it to remain. The
color rules's range is not necessarily the same as the raster's, and
it is not easy to know about that otherwise. The range will not extend
beyond the range of the color rules.

Of course you can edit the code and comment out the line locally..

Another solution is to draw the raster with d.rast, and then tell
d.legend to draw the legend of another map which does cover the full
range. You have to use "r.colors rast=" to be sure they use the same
rules first.


ps - the mailing list has moved from GRASSLIST(at)baylor.edu to

More information about the grass-user mailing list