[GRASS-SVN] r70468 - grass/trunk/raster/r.mode

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Feb 1 16:44:27 PST 2017


Author: annakrat
Date: 2017-02-01 16:44:26 -0800 (Wed, 01 Feb 2017)
New Revision: 70468

Modified:
   grass/trunk/raster/r.mode/main.c
Log:
r.mode: copy cover raster color table to output raster

Modified: grass/trunk/raster/r.mode/main.c
===================================================================
--- grass/trunk/raster/r.mode/main.c	2017-02-01 07:40:21 UTC (rev 70467)
+++ grass/trunk/raster/r.mode/main.c	2017-02-02 00:44:26 UTC (rev 70468)
@@ -43,6 +43,7 @@
     const char *args[5];
     struct Popen stats_child, reclass_child;
     struct Categories cover_cats;
+    struct Colors colors;
     FILE *stats, *reclass;
     int first;
     long basecat, covercat, catb, catc;
@@ -138,5 +139,10 @@
     G_popen_close(&reclass_child);
     G_popen_close(&stats_child);
 
+    if (Rast_read_colors(parm.cover->answer, "", &colors) < 0)
+	G_fatal_error(_("Unable to read color table for %s"),
+			parm.cover->answer);
+    Rast_write_colors(parm.output->answer, G_mapset(), &colors);
+
     return 0;
 }



More information about the grass-commit mailing list