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

Michael Barton michael.barton at asu.edu
Thu Oct 4 02:46:31 EDT 2007

Please see below

On 10/3/07 12:13 PM, "Benjamin Ducke" <benjamin.ducke at ufg.uni-kiel.de>

> [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?

GRASS color names (e.g., red, blue, yellow)

> 2. Is '%" treated like a comment in the GRASS 'colr' files?

It is treated like a percent.

0% black
50% red
100% green

is translated as make the lowest (0%) value black and grade to red at the
median value (50%), then continue to grade to blue to the highest value

> 3. Is '#' as a comment indicator also OK in 'colr' files?

I don't think this is accepted. But try and see.

> 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)?

Not sure what you mean here. Replace the label value with the RBG value?


> Benjamin
> Dylan Beaudette wrote:
>> On Wednesday 03 October 2007, Benjamin Ducke wrote:
>>> Good stuff
>>> All the palettes are available in GMT color format, which is just plain
>>> ASCII and very similar to GRASS' own colour rule files in the 'cols'
>>> database elements. The only major difference seems to be three
>>> additional lines at the end of the file specifying colours for
>>> foreground, background and no data areas which could simply be
>>> discarded.
>> Indeed. Will have to poke around in the r.colors source -- anyone an expert
>> on 
>> how the rules file is parsed?
>>> So how about adding an option cpt=filename to r.colors, to set the
>>> color rules for a raster map from a GMT ASCII file?
>> I think that this would be a great addition. The GMT folks might like it as
>> well.
>>> The best of these styles could still be hardcoded into r.colors'
>>> database.
>> Agreed.
>>> Benjamin
>>> P.S.: Some of these palettes actually have licenses attached to them.
>>> What sort of a world do we live in that requires the most trivial
>>> things to be licensed? Come on people, you can give _some_ things to
>>> the public domain w/o conditions ...
>> My thoughts exactly- however you are going to have to pay-up if you decide to
>> implement this idea!  j/k
>> Dylan
>>> Dylan Beaudette wrote:
>>>> Sorry about those last two messages. My fingers where too fast for my
>>>> brain, and inadvertently caused the keys ctrl-enter to be pressed (curse
>>>> you Kmail!).
>>>> What I had tried to mention was the collection of color palette files
>>>> here:
>>>> http://sview01.wiredworkplace.net/pub/cpt-city/
>>>> Perhaps we can convert a pile of these into GRASS-compatible color rules
>>>> files.
>>>> Cheers,
>>>> Dylan

Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

More information about the grass-dev mailing list