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.


_______________________________________________
grass-user mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to