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

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Sep 29 22:26:34 EDT 2010


Author: hamish
Date: 2010-09-30 02:26:34 +0000 (Thu, 30 Sep 2010)
New Revision: 43732

Modified:
   grass-addons/imagery/i.landsat.acca/algorithm.c
   grass-addons/imagery/i.landsat.acca/local_proto.h
   grass-addons/imagery/i.landsat.acca/main.c
   grass-addons/imagery/i.landsat.acca/tools.c
Log:
reapply a couple of prior cleanups;
renamed second_pass variable name as meaning has inverted;
svn props


Modified: grass-addons/imagery/i.landsat.acca/algorithm.c
===================================================================
--- grass-addons/imagery/i.landsat.acca/algorithm.c	2010-09-30 02:02:28 UTC (rev 43731)
+++ grass-addons/imagery/i.landsat.acca/algorithm.c	2010-09-30 02:26:34 UTC (rev 43732)
@@ -56,17 +56,17 @@
   como opciones desde el programa main.
  ---------------------------------------------------------*/
 
-double th_1 = 0.08;		/* Band 3 Brightness Thershold */
+double th_1 = 0.08;		/* Band 3 Brightness Threshold */
 double th_1_b = 0.07;
-double th_2[] = { -0.25, 0.70 };	/* Normalized Snow Difference Index */
+double th_2[] = { -0.25, 0.70 }; /* Normalized Snow Difference Index */
 
 double th_2_b = 0.8;
-double th_3 = 300.;		/* Band 6 Temperature Thershold */
+double th_3 = 300.;		/* Band 6 Temperature Threshold */
 double th_4 = 225.;		/* Band 5/6 Composite */
 double th_4_b = 0.08;
 double th_5 = 2.35;		/* Band 4/3 Ratio */
 double th_6 = 2.16248;		/* Band 4/2 Ratio */
-double th_7 = 1.0; /* Band 4/5 Ratio */ ;
+double th_7 = 1.0; 		/* Band 4/5 Ratio */ ;
 double th_8 = 210.;		/* Band 5/6 Composite */
 
 extern int hist_n;
@@ -74,7 +74,7 @@
 #define K_BASE  240.
 
 void acca_algorithm(int verbose, Gfile * out, Gfile band[],
-		    int two_pass, int with_shadow, int cloud_signature)
+		    int single_pass, int with_shadow, int cloud_signature)
 {
     int i, count[5], hist_cold[hist_n], hist_warm[hist_n];
     double max, value[5], signa[5], idesert, review_warm, shift;
@@ -122,15 +122,15 @@
     signa[KMEAN] = (signa[SUM_COLD] / (double)count[COLD]) * SCALE;
     signa[COVER] = (double)count[COLD] / (double)count[TOTAL];
 
-    G_message(">  PRELIMINARY SCENE ANALYSIS\n");
+    G_message(">  PRELIMINARY SCENE ANALYSIS");
     G_message(">    Desert index:  %.3lf", idesert);
     G_message(">    Snow cover:    %.3lf %%", 100. * value[SNOW]);
     G_message(">    Cloud cover:   %.3lf %%", 100. * signa[COVER]);
     G_message(">    Temperature of clouds");
-    G_message(">      Maximum: %.2lf K\n", signa[KMAX]);
-    G_message(">      Mean (%s cloud)  : %.2lf K\n",
+    G_message(">      Maximum: %.2lf K", signa[KMAX]);
+    G_message(">      Mean (%s cloud)  : %.2lf K",
 	      (review_warm ? "cold" : "all"), signa[KMEAN]);
-    G_message(">      Minimum: %.2lf K\n", signa[KMIN]);
+    G_message(">      Minimum: %.2lf K", signa[KMIN]);
 
     /* WARNING: re-use of the variable 'value' with new meaning */
 
@@ -164,25 +164,25 @@
 	    }
 	}
 
-	G_message(">  HISTOGRAM CLOUD SIGNATURE\n");
-	G_message(">      Histogram classes:  %d\n", hist_n);
-	G_message(">      Mean temperature:   %.2lf K\n", value[MEAN]);
-	G_message(">      Standard deviation: %.2lf  \n", value[DSTD]);
-	G_message(">      Skewness:           %.2lf  \n", value[SKEW]);
-	G_message(">      Cold cloud: maximun %.2lf K\n", value[KUPPER]);
-	G_message(">      Warn cloud: maximun %.2lf K\n", value[KLOWER]);
+	G_message(">  HISTOGRAM CLOUD SIGNATURE");
+	G_message(">      Histogram classes:  %d", hist_n);
+	G_message(">      Mean temperature:   %.2lf K", value[MEAN]);
+	G_message(">      Standard deviation: %.2lf", value[DSTD]);
+	G_message(">      Skewness:           %.2lf", value[SKEW]);
+	G_message(">      Cold cloud: maximun %.2lf K", value[KUPPER]);
+	G_message(">      Warn cloud: maximun %.2lf K", value[KLOWER]);
     }
     else {
 	if (signa[KMEAN] < 295.) {
 	    /* Retained warm and cold clouds */
-	    G_message("    Scene with clouds\n");
+	    G_message("    Scene with clouds");
 	    review_warm = 0;
 	    value[KUPPER] = 0.;
 	    value[KLOWER] = 0.;
 	}
 	else {
 	    /* Retained cold clouds */
-	    G_message("    Scene cloud free\n");
+	    G_message("    Scene cloud free");
 	    review_warm = 1;
 	    value[KUPPER] = 0.;
 	    value[KLOWER] = 0.;
@@ -191,7 +191,7 @@
 
     /* SECOND FILTER ... */
     /* By-pass two processing but it retains warm and cold clouds */
-    if (two_pass == 1) {
+    if (single_pass == TRUE) {
 	review_warm = -1.;
 	value[KUPPER] = 0.;
 	value[KLOWER] = 0.;
@@ -219,7 +219,7 @@
 	G_fatal_error(_("Unable to create raster map <%s>"), out->name);
 
     /* ----- ----- */
-    G_message("Pass one processing ...");
+    G_message(_("Processing first pass ..."));
 
     stats[SUM_COLD] = 0.;
     stats[SUM_WARM] = 0.;
@@ -256,11 +256,11 @@
 		nsdi = (pixel[BAND2] - pixel[BAND5]) /
 		    (pixel[BAND2] + pixel[BAND5]);
 		/* ----------------------------------------------------- */
-		/* Brightness Thershold: Eliminates dark images */
+		/* Brightness Threshold: Eliminates dark images */
 		if (pixel[BAND3] > th_1) {
 		    /* Normalized Snow Difference Index: Eliminates many types of snow */
 		    if (nsdi > th_2[0] && nsdi < th_2[1]) {
-			/* Temperature Thershold: Eliminates warm image features */
+			/* Temperature Threshold: Eliminates warm image features */
 			if (pixel[BAND6] < th_3) {
 			    rat56 = (1. - pixel[BAND5]) * pixel[BAND6];
 			    /* Band 5/6 Composite: Eliminates numerous categories including ice */
@@ -409,7 +409,7 @@
 		    }
 		}
 		else
-		    /* Joint warm (not ambiguous) and cold clouds */
+		    /* Join warm (not ambiguous) and cold clouds */
 		if (code == COLD_CLOUD || code == WARM_CLOUD) {
 		    ((CELL *) tmp.rast)[col] = (code == WARM_CLOUD &&
 						review_warm ==


Property changes on: grass-addons/imagery/i.landsat.acca/algorithm.c
___________________________________________________________________
Added: svn:mime-type
   + text/x-csrc


Property changes on: grass-addons/imagery/i.landsat.acca/local_proto.h
___________________________________________________________________
Added: svn:mime-type
   + text/x-chdr

Modified: grass-addons/imagery/i.landsat.acca/main.c
===================================================================
--- grass-addons/imagery/i.landsat.acca/main.c	2010-09-30 02:02:28 UTC (rev 43731)
+++ grass-addons/imagery/i.landsat.acca/main.c	2010-09-30 02:26:34 UTC (rev 43732)
@@ -119,11 +119,6 @@
 	_("Base name of the landsat band rasters ([band_prefix].[band_number])");
 
     output = G_define_standard_option(G_OPT_R_OUTPUT);
-    output->key = _("output");
-    output->type = TYPE_STRING;
-    output->required = YES;
-    output->gisprompt = _("output,cell,raster");
-    output->description = _("Output file name");
 
     b56c = G_define_option();
     b56c->key = "b56composite";
@@ -136,42 +131,37 @@
     hist->key = "histogram";
     hist->type = TYPE_INTEGER;
     hist->required = NO;
-    hist->gisprompt = _("input,integer");
     hist->description =
 	_("Number of classes in the cloud temperature histogram");
     hist->answer = "100";
 
     sat5 = G_define_flag();
     sat5->key = '5';
-    sat5->description =
-	_("Landsat-5 TM (i.e. thermal band is '.6' not '.61')");
-    sat5->answer = 0;
+    sat5->label = _("Data is Landsat-5 TM");
+    sat5->description = _("(i.e. thermal band is '.6' not '.61')");
 
     filter = G_define_flag();
     filter->key = 'f';
     filter->description =
 	_("Apply post-processing filter to remove small holes");
-    filter->answer = 0;
 
     csig = G_define_flag();
     csig->key = 'x';
     csig->description = _("Always use cloud signature (step 14)");
-    csig->answer = 0;
 
     pass2 = G_define_flag();
     pass2->key = '2';
     pass2->description =
-	_("By-pass second processing, and join warm (not ambiguous) and cold clouds");
-    pass2->answer = 0;
+	_("Bypass second-pass processing, and merge warm (not ambiguous) and cold clouds");
 
     shadow = G_define_flag();
     shadow->key = 's';
     shadow->description = _("Include a category for cloud shadows");
-    shadow->answer = 0;
 
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
+
     /* stores OPTIONS and FLAGS to variables */
 
     hist_n = atoi(hist->answer);


Property changes on: grass-addons/imagery/i.landsat.acca/main.c
___________________________________________________________________
Added: svn:mime-type
   + text/x-csrc

Modified: grass-addons/imagery/i.landsat.acca/tools.c
===================================================================
--- grass-addons/imagery/i.landsat.acca/tools.c	2010-09-30 02:02:28 UTC (rev 43731)
+++ grass-addons/imagery/i.landsat.acca/tools.c	2010-09-30 02:26:34 UTC (rev 43732)
@@ -129,7 +129,7 @@
     brast = G_allocate_raster_buf(CELL_TYPE);
     crast = G_allocate_raster_buf(CELL_TYPE);
     if ((out->fd = G_open_cell_old(out->name, mapset)) < 0)
-	G_fatal_error("Unable to open raster map <%s>", out->name);
+	G_fatal_error(_("Unable to open raster map <%s>"), out->name);
 
     /* Open to write */
     sprintf(tmp.name, "_%d.BBB", getpid());
@@ -137,7 +137,7 @@
     if ((tmp.fd = G_open_raster_new(tmp.name, CELL_TYPE)) < 0)
 	G_fatal_error(_("Unable to create raster map <%s>"), tmp.name);
 
-    G_message(_("Filling small holes in cloud ..."));
+    G_message(_("Filling small holes in clouds ..."));
 
     /* Se puede acelerar creandolos nulos y luego arast = brast
        brast = crast y cargando crast solamente


Property changes on: grass-addons/imagery/i.landsat.acca/tools.c
___________________________________________________________________
Added: svn:mime-type
   + text/x-csrc



More information about the grass-commit mailing list