[GRASS-SVN] r39276 - grass/trunk/raster/r.colors

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 21 17:25:57 EDT 2009


Author: martinl
Date: 2009-09-21 17:25:57 -0400 (Mon, 21 Sep 2009)
New Revision: 39276

Modified:
   grass/trunk/raster/r.colors/thumbnails.py
Log:
skip comments


Modified: grass/trunk/raster/r.colors/thumbnails.py
===================================================================
--- grass/trunk/raster/r.colors/thumbnails.py	2009-09-21 17:38:36 UTC (rev 39275)
+++ grass/trunk/raster/r.colors/thumbnails.py	2009-09-21 21:25:57 UTC (rev 39276)
@@ -119,7 +119,12 @@
         text = fh.read()
         fh.close()
         lines = text.splitlines()
-        records = [line.split() for line in lines]
+        records = list()
+        for line in lines:
+            if line.startswith("#"):
+                # skip comments
+                continue
+            records.append(line.split())
         records = [record for record in records if record[0] != 'nv']
         relative = False
         absolute = False
@@ -140,12 +145,12 @@
 		maxval = min(maxval, 2500000)
 	    grad = tmp_grad_abs
 	    grass.mapcalc("$grad = if(row()==1, float($min), float($max))",
-                          grad = tmp_grad_abs, min = minval, max = maxval)
+                          grad = tmp_grad_abs, min = minval, max = maxval, quiet = True)
 	else:
             grad = tmp_grad_rel
 
         grass.run_command("r.colors", map = grad, color = table, quiet = True)
-        grass.run_command("d.colortable", flags = 'n', map = grad)
+        grass.run_command("d.colortable", flags = 'n', map = grad, quiet = True)
 
 	outfile = os.path.join(output_dir, "Colortable_%s.png" % table)
 	convert_and_rotate(tmp_img, outfile)



More information about the grass-commit mailing list