[GRASS-user] trimming color table

Glynn Clements glynn at gclements.plus.com
Fri Sep 18 01:06:51 PDT 2015


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.

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


More information about the grass-user mailing list