[GRASS-dev] [grass-code I][508] r.colors: last 100% rule is forgotten

Glynn Clements glynn at gclements.plus.com
Wed Oct 10 06:18:09 EDT 2007


grass-dev at grass.itc.it wrote:

> code I item #508, was opened at 2007-10-10 19:37
> Status: Open
> Priority: 3
> Submitted By: Hamish Bowman (hamish)
> Assigned to: Nobody (None)
> Summary: r.colors: last 100% rule is forgotten 
> Issue type: module bug
> Issue status: None
> GRASS version: 6.2
> GRASS component: raster
> Operating system: Linux
> Operating system version: debian/etch
> GRASS CVS checkout date, if applies (YYMMDD): 
> 
> 
> Initial Comment:
> as reported on the mailing list:
>   http://article.gmane.org/gmane.comp.gis.grass.devel/22645
> 
> There seems to be a bug in r.colors in 6.2 and 6.3.
> 
> e.g. for a CELL map containing values of [0-255], if the rules file looks
> like this:
> 
> 0% 0:0:0  37.5% 255:0:0
> 37.5% 255:0:0  75% 255:255:0
> 75% 255:255:0  100% 255:255:255

Why do you think that format should be accepted? AFAICT, nothing in
the r.colors documentation indicates that it should be, nor, AFAICT,
has it ever been this way.

FWIW, everything after the colour is discarded, so the above is
treated exactly the same as:

	0% 0:0:0
	37.5% 255:0:0
	75% 255:255:0

> the usual way to give percentage is typically 1 rule per line,

No, the *correct* way to give rules (percentage or absolute) to
r.colors is 1 rule per line. It's not a matter of what's "typical" or
"usual".

I daresay that I can tweak G_parse_color_rule() to return an error if
a line has trailing garbage, rather than simply discarding it.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list