[GRASS-SVN] r34762 - grass/branches/develbranch_6/raster/r.contour

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Dec 6 18:14:12 EST 2008


Author: martinl
Date: 2008-12-06 18:14:11 -0500 (Sat, 06 Dec 2008)
New Revision: 34762

Modified:
   grass/branches/develbranch_6/raster/r.contour/cont.c
   grass/branches/develbranch_6/raster/r.contour/main.c
Log:
r.contours: message cosmetics & standardization


Modified: grass/branches/develbranch_6/raster/r.contour/cont.c
===================================================================
--- grass/branches/develbranch_6/raster/r.contour/cont.c	2008-12-06 22:44:41 UTC (rev 34761)
+++ grass/branches/develbranch_6/raster/r.contour/cont.c	2008-12-06 23:14:11 UTC (rev 34762)
@@ -78,11 +78,10 @@
 
     ncrossing = 0;
 
-    G_message(_("Total levels: %4d"), nlevels);
+    G_message(_("Writing vector contours (total levels %d)..."), nlevels);
 
     for (n = 0; n < nlevels; n++) {
 	level = levels[n];
-	G_percent(n, nlevels, 2);	/* print progress */
 
 	/* initialize hit array */
 	for (i = 0; i < nrow - 1; i++) {
@@ -205,6 +204,7 @@
 		}		/* if ! hit */
 	    }			/* for rows */
 	}			/* for columns */
+	G_percent(n+1, nlevels, 2);	/* print progress */
     }				/* for levels */
 
     if (ncrossing > 0) {

Modified: grass/branches/develbranch_6/raster/r.contour/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.contour/main.c	2008-12-06 22:44:41 UTC (rev 34761)
+++ grass/branches/develbranch_6/raster/r.contour/main.c	2008-12-06 23:14:11 UTC (rev 34762)
@@ -9,7 +9,7 @@
  * PURPOSE:      Produces a vector map of specified contours from a 
  *               raster map layer.
  *
- * COPYRIGHT:    (C) 2001 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2001-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
@@ -88,9 +88,9 @@
     G_gisinit(argv[0]);
 
     module = G_define_module();
-    module->keywords = _("raster");
-    module->description = _("Produces a vector map layer of specified "
-			    "contours from a raster map layer.");
+    module->keywords = _("raster, DEM, contours, vector");
+    module->description = _("Produces a vector map of specified "
+			    "contours from a raster map.");
 
     map = G_define_standard_option(G_OPT_R_INPUT);
 
@@ -162,7 +162,8 @@
 	G_fatal_error(_("Unable to open raster map <%s>"), name);
 
     if (G_read_fp_range(name, mapset, &range) < 0)
-	G_fatal_error(_("Could not read range file"));
+	G_fatal_error(_("Unable to read fp range of raster map <%s>"),
+		      name);
 
     /* get window info */
     G_get_window(&Wind);
@@ -192,11 +193,13 @@
     G_debug(1, "SQL: %s", db_get_string(&sql));
 
     if (db_execute_immediate(Driver, &sql) != DB_OK) {
-	G_fatal_error(_("Unable to create table: %s"), db_get_string(&sql));
+	G_fatal_error(_("Unable to create table: '%s'"),
+		      db_get_string(&sql));
     }
 
-    if (db_create_index2(Driver, Fi->table, "cat") != DB_OK)
-	G_warning(_("Cannot create index"));
+    if (db_create_index2(Driver, Fi->table, Fi->key) != DB_OK)
+	G_warning(_("Unable to create index for table <%s>, key <%s>"),
+		  Fi->table, Fi->key);
 
     if (db_grant_on_table
 	(Driver, Fi->table, DB_PRIV_SELECT, DB_GROUP | DB_PUBLIC) != DB_OK)
@@ -218,7 +221,7 @@
 	G_debug(3, "SQL: %s", db_get_string(&sql));
 
 	if (db_execute_immediate(Driver, &sql) != DB_OK) {
-	    G_fatal_error(_("Unable to insert row: %s"), db_get_string(&sql));
+	    G_fatal_error(_("Unable to insert new record: '%s'"), db_get_string(&sql));
 	}
     }
 
@@ -227,8 +230,6 @@
     Vect_build(&Map);
     Vect_close(&Map);
 
-    G_done_msg("");
-
     exit(EXIT_SUCCESS);
 }
 
@@ -240,13 +241,12 @@
 
     z_array = (DCELL **) G_malloc(nrow * sizeof(DCELL *));
 
-    G_message(_("Reading data: "));
+    G_message(_("Reading data..."));
 
     for (i = 0; i < nrow; i++) {
 	z_array[i] = (DCELL *) G_malloc(ncol * sizeof(DCELL));
 	G_get_d_raster_row(fd, z_array[i], i);
 	G_percent(i + 1, nrow, 2);
-
     }
     return z_array;
 }
@@ -267,9 +267,9 @@
     G_get_fp_range_min_max(range, &zmin, &zmax);
 
     if (!G_is_d_null_value(&zmin) && !G_is_d_null_value(&zmax))
-	G_message(_("Range of data:    min =  %f max = %f"), zmin, zmax);
+	G_verbose_message(_("Range of data: min=%f, max=%f"), zmin, zmax);
     else
-	G_message(_("Range of data:    empty"));
+	G_verbose_message(_("Range of data: empty"));
 
     nlevels = 0;
     if (levels->answers) {
@@ -296,11 +296,11 @@
 	dstep = atof(step->answer);
 	/* fix if step < 1, Roger Bivand 1/2001: */
 	dmax = (max->answer) ? atof(max->answer) : dstep == 0 ?
-	    G_fatal_error(_("This step value is not allowed.")) : zmax -
+	    G_fatal_error(_("This step value is not allowed")) : zmax -
 	    fmod(zmax, dstep);
 	dmin =
 	    (min->answer) ? atof(min->answer) : dstep ==
-	    0 ? G_fatal_error(_("This step value is not allowed.")) :
+	    0 ? G_fatal_error(_("This step value is not allowed")) :
 	    fmod(zmin, dstep) ? zmin - fmod(zmin, dstep) + dstep : zmin;
 
 	while (dmin < zmin) {
@@ -324,7 +324,7 @@
 	dmin = dmin < zmin ? zmin : dmin;
 	dmax = dmax > zmax ? zmax : dmax;
 
-	G_message(_("Range of levels: min = %f max = %f"), dmin, dmax);
+	G_verbose_message(_("Range of levels: min = %f, max = %f"), dmin, dmax);
 
 	nlevels = (dmax - dmin) / dstep + 2;
 	lev = (double *)G_malloc(nlevels * sizeof(double));
@@ -353,7 +353,7 @@
     double *currRow;
     double currVal;
 
-    G_message(_("Displacing data: "));
+    G_message(_("Displacing data..."));
 
     for (i = 0; i < nrow; i++) {
 	currRow = z[i];



More information about the grass-commit mailing list