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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Apr 22 00:37:49 EDT 2009


Author: glynn
Date: 2009-04-22 00:37:49 -0400 (Wed, 22 Apr 2009)
New Revision: 36855

Modified:
   grass/trunk/raster/r.colors/stats.c
Log:
Fix stats calculation with -a


Modified: grass/trunk/raster/r.colors/stats.c
===================================================================
--- grass/trunk/raster/r.colors/stats.c	2009-04-21 22:04:18 UTC (rev 36854)
+++ grass/trunk/raster/r.colors/stats.c	2009-04-22 04:37:49 UTC (rev 36855)
@@ -91,8 +91,11 @@
     if (statf->geom_abs) {
 	double a = log(fabs(min) + 1);
 	double b = log(fabs(max) + 1);
+	int has_zero = min * max < 0;
 	min = a < b ? a : b;
 	max = a > b ? a : b;
+	if (has_zero)
+	    min = 0;
     }
 
     statf->count = 1000;



More information about the grass-commit mailing list