[GRASS-SVN] r43704 - grass-addons/imagery/i.landsat.acca

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 27 11:01:57 EDT 2010


Author: ejtizado
Date: 2010-09-27 15:01:57 +0000 (Mon, 27 Sep 2010)
New Revision: 43704

Modified:
   grass-addons/imagery/i.landsat.acca/algorithm.c
Log:
original ratio 5/6

Modified: grass-addons/imagery/i.landsat.acca/algorithm.c
===================================================================
--- grass-addons/imagery/i.landsat.acca/algorithm.c	2010-09-27 14:34:14 UTC (rev 43703)
+++ grass-addons/imagery/i.landsat.acca/algorithm.c	2010-09-27 15:01:57 UTC (rev 43704)
@@ -30,7 +30,7 @@
 #define KUPPER      1
 #define MEAN        2
 #define SKEW        3
-#define VARI        4
+#define DSTD        4
 
 /*
     Con Landsat-7 funciona bien pero con Landsat-5 falla
@@ -100,8 +100,7 @@
 	value[SOIL] = (double)count[SOIL] / (double)count[TOTAL];
 
 	value[0] = (double)(count[WARM] + count[COLD]);
-	idesert = (value[0] == 0. ? 0. : value[0] /
-									(value[0] + (double)count[SOIL]));
+	idesert = (value[0] == 0. ? 0. : 1. / (1. + (double)count[SOIL])/value[0]);
 
 	/* BAND-6 CLOUD SIGNATURE DEVELOPMENT */
 	if (value[SNOW] > 0.01)
@@ -122,6 +121,7 @@
 	}
 
 	signa[KMEAN] = (signa[SUM_COLD] / (double)count[COLD]) * SCALE;
+    /* signa[KMEAN] = quantile( 0.50, hist_cold ) :::::: median */
 	signa[COVER] = (double)count[COLD] / (double)count[TOTAL];
 
 	fprintf(stdout, "  PRELIMINARY SCENE ANALYSIS\n");
@@ -139,15 +139,15 @@
 	{
 		value[KUPPER] = quantile( 0.975, hist_cold ) + K_BASE;
 		value[KLOWER] = quantile( 0.835, hist_cold ) + K_BASE;
-		value[MEAN]   = mean(hist_cold) + K_BASE;
-		value[VARI]   = moment( 2, hist_cold );
-		value[SKEW]   = moment( 3, hist_cold );
+		value[MEAN]   = mean(hist_cold) + K_BASE; /* quantile( 0.5, hist_cold ): */
+		value[DSTD]   = sqrt( moment(2, hist_cold, 1) );
+		value[SKEW]   = moment( 3, hist_cold, 3 ) / pow( value[DSTD], 3);
 
 		if (value[SKEW] > 0.)
 		{
 			shift = value[SKEW];
 			if (shift > 1.) shift = 1.;
-			shift *= sqrt( value[VARI] );
+			shift *= value[DSTD];
 
 			x = quantile( 0.9875, hist_cold ) + K_BASE;
 			if ((value[KUPPER] + shift) > x)
@@ -165,10 +165,10 @@
 		fprintf(stdout, "  HISTOGRAM CLOUD SIGNATURE\n");
 		fprintf(stdout, "      Histogram classes:  %d\n", hist_n);
 		fprintf(stdout, "      Mean temperature:   %.2lf K\n", value[MEAN]);
-		fprintf(stdout, "      Standard deviation: %.2lf\n", sqrt(value[VARI]));
-		fprintf(stdout, "      Skewness:           %.2lf\n", value[SKEW]);
-		fprintf(stdout, "      97.50 percentile:   %.2lf K\n", value[KUPPER]);
-		fprintf(stdout, "      83.50 percentile:   %.2lf K\n", value[KLOWER]);
+		fprintf(stdout, "      Standard deviation: %.2lf  \n", value[DSTD]);
+		fprintf(stdout, "      Skewness:           %.2lf  \n", value[SKEW]);
+		fprintf(stdout, "      97.50 quantile:     %.2lf K\n", value[KUPPER]);
+		fprintf(stdout, "      83.50 quantile:     %.2lf K\n", value[KLOWER]);
 	}
 	else
 	{



More information about the grass-commit mailing list