[GRASS-SVN] r73766 - grass/trunk/imagery/i.gensig

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 5 02:56:50 PST 2018


Author: marisn
Date: 2018-12-05 02:56:50 -0800 (Wed, 05 Dec 2018)
New Revision: 73766

Modified:
   grass/trunk/imagery/i.gensig/covariance.c
Log:
i.gensig: Skip NULL cells when calculating variance


Modified: grass/trunk/imagery/i.gensig/covariance.c
===================================================================
--- grass/trunk/imagery/i.gensig/covariance.c	2018-12-05 10:56:44 UTC (rev 73765)
+++ grass/trunk/imagery/i.gensig/covariance.c	2018-12-05 10:56:50 UTC (rev 73766)
@@ -40,7 +40,9 @@
 		cell2 = files->band_cell[b2];
 		for (col = 0; col < ncols; col++) {
 		    n = class[col];
-		    if (n < 0)
+		    if (n < 0 ||
+			Rast_is_d_null_value(&cell1[col]) ||
+			Rast_is_d_null_value(&cell2[col]))
 			continue;
 		    S->sig[n].var[b1][b2] +=
 			(cell1[col] - S->sig[n].mean[b1]) * (cell2[col] -



More information about the grass-commit mailing list