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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Nov 7 16:21:35 EST 2008


Author: martinl
Date: 2008-11-07 16:21:35 -0500 (Fri, 07 Nov 2008)
New Revision: 34185

Modified:
   grass/trunk/raster/r.colors/main.c
   grass/trunk/raster/r.colors/stats.c
Log:
r.colors: message cosmetics
	  (merge from devbr6, r34184)


Modified: grass/trunk/raster/r.colors/main.c
===================================================================
--- grass/trunk/raster/r.colors/main.c	2008-11-07 21:15:30 UTC (rev 34184)
+++ grass/trunk/raster/r.colors/main.c	2008-11-07 21:21:35 UTC (rev 34185)
@@ -8,7 +8,7 @@
  * PURPOSE:      Allows creation and/or modification of the color table
  *               for a raster map layer.
  *
- * COPYRIGHT:    (C) 2006 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2006-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
@@ -240,7 +240,7 @@
     rules = opt.rules->answer;
 
     if (!name)
-	G_fatal_error(_("No map specified"));
+	G_fatal_error(_("No raster map specified"));
 
     if (!cmap && !style && !rules && !remove)
 	G_fatal_error(_("One of \"-r\" or options \"color\", \"raster\" or \"rules\" must be specified!"));
@@ -260,9 +260,9 @@
 	int stat = G_remove_colors(name, mapset);
 
 	if (stat < 0)
-	    G_fatal_error(_("%s - unable to remove color table"), name);
+	    G_fatal_error(_("Unable to remove color table of raster map <%s>"), name);
 	if (stat == 0)
-	    G_warning(_("%s - color table not found"), name);
+	    G_warning(_("Color table of raster map <%s> not found"), name);
 	return EXIT_SUCCESS;
     }
 
@@ -290,19 +290,19 @@
 	 */
 	if (strcmp(style, "random") == 0) {
 	    if (fp)
-		G_fatal_error(_("Can't make random color table for floating point map"));
+		G_fatal_error(_("Color table 'random' is not supported for floating point raster map"));
 	    G_make_random_colors(&colors, (CELL) min, (CELL) max);
 	}
 	else if (strcmp(style, "grey.eq") == 0) {
 	    if (fp)
-		G_fatal_error(_("Can't make grey.eq color table for floating point map"));
+		G_fatal_error(_("Color table 'grey.eq' is not supported for floating point raster map"));
 	    if (!have_stats)
 		have_stats = get_stats(name, mapset, &statf);
 	    G_make_histogram_eq_colors(&colors, &statf);
 	}
 	else if (strcmp(style, "grey.log") == 0) {
 	    if (fp)
-		G_fatal_error(_("Can't make logarithmic color table for floating point map"));
+		G_fatal_error(_("Color table 'grey.log' is not supported for floating point raster map"));
 	    if (!have_stats)
 		have_stats = get_stats(name, mapset, &statf);
 	    G_make_histogram_log_colors(&colors, &statf, (CELL) min,
@@ -311,7 +311,7 @@
 	else if (find_rule(style))
 	    G_make_fp_colors(&colors, style, min, max);
 	else
-	    G_fatal_error(_("%s - unknown color request"), style);
+	    G_fatal_error(_("Unknown color request '%s'"), style);
     }
     else if (rules) {
 	if (!G_load_fp_colors(&colors, rules, min, max)) {
@@ -322,7 +322,7 @@
 	    sprintf(path, "%s/etc/colors/%s", G_gisbase(), rules);
 
 	    if (!G_load_fp_colors(&colors, path, min, max))
-		G_fatal_error(_("Unable to load rules file %s"), rules);
+		G_fatal_error(_("Unable to load rules file <%s>"), rules);
 	}
     }
     else {
@@ -332,7 +332,7 @@
 	    G_fatal_error(_("Raster map <%s> not found"), cmap);
 
 	if (G_read_colors(cmap, cmapset, &colors) < 0)
-	    G_fatal_error(_("Unable to read color table for %s"), cmap);
+	    G_fatal_error(_("Unable to read color table for raster map <%s>"), cmap);
     }
 
     if (fp)
@@ -364,7 +364,7 @@
 	G_mark_colors_as_fp(&colors);
 
     if (G_write_colors(name, mapset, &colors) >= 0)
-	G_message(_("Color table for <%s> set to %s"), name,
+	G_message(_("Color table for raster map <%s> set to '%s'"), name,
 		  is_from_stdin ? "rules" : style ? style : rules ? rules :
 		  cmap);
 

Modified: grass/trunk/raster/r.colors/stats.c
===================================================================
--- grass/trunk/raster/r.colors/stats.c	2008-11-07 21:15:30 UTC (rev 34184)
+++ grass/trunk/raster/r.colors/stats.c	2008-11-07 21:21:35 UTC (rev 34185)
@@ -30,18 +30,21 @@
     int fd;
 
     if ((fd = G_open_cell_old(name, mapset)) < 0)
-	G_fatal_error("error opening map <%s@%s>", name, mapset);
+	G_fatal_error(_("Unable to open raster map <%s>"),
+		      G_fully_qualified_name(name, mapset));
 
     cell = G_allocate_cell_buf();
     nrows = G_window_rows();
     ncols = G_window_cols();
 
     G_init_cell_stats(statf);
-    G_message(_("Reading %s ..."), name);
+    G_verbose_message(_("Reading raster map <%s>..."),
+		      G_fully_qualified_name(name, mapset));
     for (row = 0; row < nrows; row++) {
 	G_percent(row, nrows, 2);
 	if (G_get_c_raster_row(fd, cell, row) < 0)
-	    G_fatal_error("error reading map <%s@%s>", name, mapset);
+	    G_fatal_error(_("Unable to read raster map <%s> row %d"),
+			  G_fully_qualified_name(name, mapset), row);
 	G_update_cell_stats(cell, ncols, statf);
     }
     G_percent(row, nrows, 2);
@@ -60,7 +63,8 @@
     int fd;
 
     if ((fd = G_open_cell_old(name, mapset)) < 0)
-	G_fatal_error("error opening map <%s@%s>", name, mapset);
+	G_fatal_error("Unable to open raster map <%s>",
+		      G_fully_qualified_name(name, mapset));
 
     dcell = G_allocate_d_raster_buf();
     nrows = G_window_rows();
@@ -71,7 +75,7 @@
 
     if (statf->geometric) {
 	if (min * max < 0)
-	    G_fatal_error(_("Cannot use logarithmic scaling if range includes zero"));
+	    G_fatal_error(_("Unable to use logarithmic scaling if range includes zero"));
 
 	if (min < 0) {
 	    statf->flip = 1;
@@ -89,13 +93,15 @@
     statf->stats = G_calloc(statf->count, sizeof(unsigned long));
     statf->total = 0;
 
-    G_message(_("Reading %s ..."), name);
+    G_verbose_message(_("Reading raster map <%s>..."),
+		      G_fully_qualified_name(name, mapset));
     for (row = 0; row < nrows; row++) {
 	G_percent(row, nrows, 2);
 
 	if (G_get_d_raster_row(fd, dcell, row) < 0)
-	    G_fatal_error("error reading map <%s@%s>", name, mapset);
-
+	    G_fatal_error(_("Unable to read raster map <%s> row %d"),
+			  G_fully_qualified_name(name, mapset), row);
+	
 	for (col = 0; col < ncols; col++) {
 	    DCELL x;
 	    int i;



More information about the grass-commit mailing list