[GRASS-dev] Re: [GRASS-user] [off-topic] spoke too soon

Glynn Clements glynn at gclements.plus.com
Thu Oct 4 07:02:18 EDT 2007

Benjamin Ducke wrote:

> [taking this over to the devel list]
> Parsing GRASS colour rules is very simple. It's all in the
> GRASS Programmer's Manual.
> Full docs for CPT format are here:
> http://gmt.soest.hawaii.edu/gmt/doc/html/GMT_Docs/node58.html
> (section 4.15 of the GMT docs)
> Apparently, GMT supports HSV schemes, as well.
> 1. Does GRASS also support colour models other than RGB?

No. It supports R/G/B, or a single (monochrome) intensity, or a named

Converting HSV->RGB on input won't produce the same result if GMT
interpolates the values in HSV space. Extending the core GRASS colour
handling to allow HSV colour rules isn't feasible, IMHO. If you want
to import HSV colour tables, the segments will need to be subdivided
to an adequate resolution.

> 2. Is '%" treated like a comment in the GRASS 'colr' files?
> 3. Is '#' as a comment indicator also OK in 'colr' files?

The format of "colr" files isn't relevant. Those files are read and
written by libgis; the file format isn't considered a public

The input format used by r.colors (lib/gis/color_rules.c) is
considered a public interface. That format uses # for comments, while
% is used for percentages.

> 4. GMT also has labels for colour ranges. Would it be a good
> idea to transfer those to the raster file (given that there
> is no category labelling already or the user chooses to
> overwrite it)?

Maybe, but that isn't the job of r.colors; if you want to add that
feature, create a separate module (which could import both the colour
and label information).

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list