[GRASS-SVN] r34369 - grass/trunk/imagery/i.pca

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Nov 18 09:25:20 EST 2008


Author: martinl
Date: 2008-11-18 09:25:20 -0500 (Tue, 18 Nov 2008)
New Revision: 34369

Modified:
   grass/trunk/imagery/i.pca/main.c
   grass/trunk/imagery/i.pca/support.c
Log:
i.pca: message standardization, more keywords
       (merge from devbr6, r34368)


Modified: grass/trunk/imagery/i.pca/main.c
===================================================================
--- grass/trunk/imagery/i.pca/main.c	2008-11-18 14:24:21 UTC (rev 34368)
+++ grass/trunk/imagery/i.pca/main.c	2008-11-18 14:25:20 UTC (rev 34369)
@@ -8,7 +8,7 @@
  *
  * PURPOSE:      Principal Component Analysis transform of satellite data.
  *
- * COPYRIGHT:    (C) 2004-2007 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2004-2008 by the GRASS Development Team
  *
  *               This program is free software under the GNU General Public
  *               License (>=v2). Read the file COPYING that comes with GRASS
@@ -60,7 +60,7 @@
     G_gisinit(argv[0]);
 
     module = G_define_module();
-    module->keywords = _("imagery");
+    module->keywords = _("imagery, image transformation, PCA");
     module->description = _("Principal components analysis (pca) program "
 			    "for image processing.");
 
@@ -127,7 +127,7 @@
 			  opt_in->answers[i]);
     }
 
-    G_message(_("Calculating covariance matrix:"));
+    G_verbose_message(_("Calculating covariance matrix..."));
     calc_mu(inp_fd, mu, bands);
 
     calc_covariance(inp_fd, covar, mu, bands);
@@ -141,7 +141,7 @@
 	}
     }
 
-    G_debug(1, _("Calculating eigenvalues and eigenvectors..."));
+    G_debug(1, "Calculating eigenvalues and eigenvectors...");
     eigen(covar, eigmat, eigval, bands);
 
 #ifdef PCA_DEBUG
@@ -149,10 +149,10 @@
     dump_eigen(bands, eigmat, eigval);
 #endif
 
-    G_debug(1, _("Ordering eigenvalues in descending order..."));
+    G_debug(1, "Ordering eigenvalues in descending order...");
     egvorder2(eigval, eigmat, bands);
 
-    G_debug(1, _("Transposing eigen matrix..."));
+    G_debug(1, "Transposing eigen matrix...");
     transpose2(eigmat, bands);
 
     /* write output images */
@@ -203,7 +203,8 @@
 	    if (*scale_min == 0)
 		*scale = 0;
 	    else {
-		G_warning(_("Scale range length should be > 0. Using default values: 0,255"));
+		G_warning(_("Scale range length should be > 0. "
+			    "Using default values: 0,255."));
 		*scale_min = 0;
 		*scale_max = 255;
 	    }
@@ -239,16 +240,16 @@
 	if (rowbuf)
 	    G_free(rowbuf);
 	if ((rowbuf = G_allocate_raster_buf(maptype)) == NULL)
-	    G_fatal_error(_("Cannot allocate memory for row buffer"));
+	    G_fatal_error(_("Unable allocate memory for row buffer"));
 
-	G_message(_("Computing Means for band %d:"), i + 1);
+	G_message(_("Computing Means for band %d..."), i + 1);
 	for (row = 0; row < rows; row++) {
 	    void *ptr = rowbuf;
 
 	    G_percent(row, rows - 1, 2);
 
 	    if (G_get_raster_row(fds[i], rowbuf, row, maptype) < 0)
-		G_fatal_error(_("Cannot read raster row [%d]"), row);
+		G_fatal_error(_("Unable to read raster map row %d"), row);
 
 	    for (col = 0; col < cols; col++) {
 		/* skip null cells */
@@ -288,16 +289,16 @@
 	if (rowbuf1)
 	    G_free(rowbuf1);
 	if ((rowbuf1 = G_allocate_raster_buf(maptype)) == NULL)
-	    G_fatal_error(_("Cannot allocate memory for row buffer"));
+	    G_fatal_error(_("Unable allocate memory for row buffer"));
 
-	G_message(_("Computing row %d of covariance matrix:"), j + 1);
+	G_message(_("Computing row %d of covariance matrix..."), j + 1);
 	for (row = 0; row < rows; row++) {
 	    void *ptr1, *ptr2;
 
 	    G_percent(row, rows - 1, 2);
 
 	    if (G_get_raster_row(fds[j], rowbuf1, row, maptype) < 0)
-		G_fatal_error(_("Cannot read raster row [%d]"), row);
+		G_fatal_error(_("Unable to read raster map row %d"), row);
 
 	    for (k = j; k < bands; k++) {
 		RASTER_MAP_TYPE maptype2 = G_get_raster_map_type(fds[k]);
@@ -306,10 +307,10 @@
 		if (rowbuf2)
 		    G_free(rowbuf2);
 		if ((rowbuf2 = G_allocate_raster_buf(maptype2)) == NULL)
-		    G_fatal_error(_("Cannot allocate memory for row buffer"));
+		    G_fatal_error(_("Unable to allocate memory for row buffer"));
 
 		if (G_get_raster_row(fds[k], rowbuf2, row, maptype2) < 0)
-		    G_fatal_error(_("Cannot read raster row [%d]"), row);
+		    G_fatal_error(_("Unable to read raster map row %d"), row);
 
 		ptr1 = rowbuf1;
 		ptr2 = rowbuf2;
@@ -369,7 +370,7 @@
 	G_allocate_raster_buf(DCELL_TYPE);
 
     if (!outbuf)
-	G_fatal_error(_("Cannot allocate memory for raster row"));
+	G_fatal_error(_("Unable to allocate memory for raster row"));
 
     for (i = 0; i < bands; i++) {
 	char name[100];
@@ -378,7 +379,7 @@
 
 	sprintf(name, "%s.%d", out_basename, i + 1);
 
-	G_message("%s: Transforming:", name);
+	G_message("Transforming <%s>...", name);
 
 	/* open a new file for output */
 	if (scale)
@@ -397,7 +398,7 @@
 	    int row, col;
 
 	    if (scale && (pass == PASSES)) {
-		G_message(_("%s: Rescaling the data to [%d,%d] range:"),
+		G_message(_("Rescaling the data <%s> to range %d,%d..."),
 			  name, scale_min, scale_max);
 
 		old_range = max - min;
@@ -421,10 +422,10 @@
 		    if (rowbuf)
 			G_free(rowbuf);
 		    if (!(rowbuf = G_allocate_raster_buf(maptype)))
-			G_fatal_error(_("Cannot allocate memory for row buffer"));
+			G_fatal_error(_("Unable allocate memory for row buffer"));
 
 		    if (G_get_raster_row(inp_fd[j], rowbuf, row, maptype) < 0)
-			G_fatal_error(_("Cannot read raster row [%d]"), row);
+			G_fatal_error(_("Unable to read raster map row %d"), row);
 
 		    rowptr = rowbuf;
 		    outptr = outbuf;

Modified: grass/trunk/imagery/i.pca/support.c
===================================================================
--- grass/trunk/imagery/i.pca/support.c	2008-11-18 14:24:21 UTC (rev 34368)
+++ grass/trunk/imagery/i.pca/support.c	2008-11-18 14:25:20 UTC (rev 34369)
@@ -24,7 +24,7 @@
 	G_mark_colors_as_fp(&colors);
 
     if (G_write_colors(outname, mapset, &colors) < 0)
-	G_message(_("Cannot write color table of raster map <%s>"), outname);
+	G_message(_("Unable to write color table for raster map <%s>"), outname);
 
     return write_history(bands, outname, eigmat);
 }



More information about the grass-commit mailing list