[GRASS-user] trimming color table

Paulo van Breugel p.vanbreugel at gmail.com
Fri Sep 18 02:39:46 PDT 2015



On 18-09-15 10:06, Glynn Clements wrote:
> Paulo van Breugel wrote:
>
>> When creating a new map based on an existing using r.mapcalc, the color
>> table of the old map is used for the new map. However, if the new map
>> only contains a subset of the values of the old map, how can I trim the
>> color table so it only contains color definitions for the values present
>> in the new map? Any easy (automatic) way to do this? Note, this is
>> probably only useful for integer (category) maps.
> There isn't an automatic way to do this. The simplest way is probably
> along the lines of
>
> 	r.colors.out map | command | r.colors map rules=-
>
> where "command" is a grep/sed/etc command which filters the rules.
Thanks. I wrote a small Python script which basically does that, so I 
can run something like 'trim(map)' with map being an integer / 
categorical map.
>



More information about the grass-user mailing list