[GRASS-SVN] r34413 - grass/trunk/raster/r.recode

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Nov 20 16:26:40 EST 2008


Author: glynn
Date: 2008-11-20 16:26:40 -0500 (Thu, 20 Nov 2008)
New Revision: 34413

Modified:
   grass/trunk/raster/r.recode/main.c
   grass/trunk/raster/r.recode/read_rules.c
   grass/trunk/raster/r.recode/recode.c
Log:
Revert r34367


Modified: grass/trunk/raster/r.recode/main.c
===================================================================
--- grass/trunk/raster/r.recode/main.c	2008-11-20 21:07:53 UTC (rev 34412)
+++ grass/trunk/raster/r.recode/main.c	2008-11-20 21:26:40 UTC (rev 34413)
@@ -6,7 +6,7 @@
  *               Bob Covill <bcovill tekmap.ns.ca>, Hamish Bowman <hamish_nospam yahoo.com>,
  *               Jan-Oliver Wagner <jan intevation.de>
  * PURPOSE:      Recode categorical raster maps
- * COPYRIGHT:    (C) 1999-2008 by the GRASS Development Team
+ * COPYRIGHT:    (C) 1999-2006 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
@@ -43,12 +43,12 @@
     } parm;
 
     /* any interaction must run in a term window */
-    /* G_putenv("GRASS_UI_TERM", "1"); */
+    G_putenv("GRASS_UI_TERM", "1");
 
     G_gisinit(argv[0]);
 
     module = G_define_module();
-    module->keywords = _("raster, recode category");
+    module->keywords = _("raster");
     module->description = _("Recodes categorical raster maps.");
 
     parm.input = G_define_standard_option(G_OPT_R_INPUT);
@@ -56,10 +56,12 @@
 
     parm.output = G_define_standard_option(G_OPT_R_OUTPUT);
 
-    parm.rules = G_define_standard_option(G_OPT_F_INPUT);
+    parm.rules = G_define_option();
     parm.rules->key = "rules";
-    parm.rules->label = _("File containing recode rules");
-    parm.rules->required = NO;
+    parm.rules->type = TYPE_STRING;
+    parm.rules->description = _("File containing recode rules");
+    parm.rules->key_desc = "name";
+    parm.rules->gisprompt = "old_file,file,input";
 
     parm.title = G_define_option();
     parm.title->key = "title";
@@ -88,7 +90,7 @@
     if (parm.rules->answer) {
 	srcfp = fopen(parm.rules->answer, "r");
 	if (!srcfp)
-	    G_fatal_error(_("Unable to open rules file <%s>"),
+	    G_fatal_error(_("Cannot open rules file <%s>"),
 			  parm.rules->answer);
     }
 
@@ -104,8 +106,5 @@
 
     do_recode();
 
-    G_done_msg(_("Raster map <%s> created."),
-	       result);
-    
     exit(EXIT_SUCCESS);
 }

Modified: grass/trunk/raster/r.recode/read_rules.c
===================================================================
--- grass/trunk/raster/r.recode/read_rules.c	2008-11-20 21:07:53 UTC (rev 34412)
+++ grass/trunk/raster/r.recode/read_rules.c	2008-11-20 21:26:40 UTC (rev 34413)
@@ -16,33 +16,29 @@
     inp_type = G_raster_map_type(name, "");
     if (inp_type != CELL_TYPE) {
 	if (G_read_fp_range(name, "", &drange) <= 0)
-	    G_fatal_error(_("Unable to read fp range of raster map <%s>"),
-			  G_fully_qualified_name(name, mapset));
+	    G_fatal_error(_("Unable to read f_range for map %s"), name);
 
 	G_get_fp_range_min_max(&drange, &old_dmin, &old_dmax);
 	if (G_is_d_null_value(&old_dmin) || G_is_d_null_value(&old_dmax))
-	    G_important_message(_("Data range of raster map <%s> is empty"),
-				G_fully_qualified_name(name, mapset));
+	    G_message(_("Data range is empty"));
 	else {
 	    sprintf(buff, "%.10f", old_dmin);
 	    sprintf(buff2, "%.10f", old_dmax);
 	    G_trim_decimal(buff);
 	    G_trim_decimal(buff2);
-	    G_message(_("Data range of raster map <%s> is %s to %s (entire map)"),
-		      G_fully_qualified_name(name, mapset), buff, buff2);
+	    G_message(_("Data range of %s is %s to %s (entire map)"), name,
+		      buff, buff2);
 	}
     }
     if (G_read_range(name, "", &range) <= 0)
-	G_fatal_error(_("Unable to read range of raster map <%s>"),
-		      G_fully_qualified_name(name, mapset));
+	G_fatal_error(_("Unable to read range for map <%s>"), name);
 
     G_get_range_min_max(&range, &old_min, &old_max);
     if (G_is_c_null_value(&old_min) || G_is_c_null_value(&old_max))
-	G_important_message(_("Integer data range of raster map <%s> is empty"),
-			    G_fully_qualified_name(name, mapset));
+	G_message(_("Integer data range of %s is empty"), name);
     else
-	G_message(_("Integer data range of raster mao <%s> is %d to %d"),
-		  G_fully_qualified_name(name, mapset), (int) old_min, (int) old_max);
+	G_message(_("Integer data range of %s is %d to %d"),
+		  name, (int)old_min, (int)old_max);
 
     return 0;
 }
@@ -124,7 +120,7 @@
 		G_fpreclass_set_neg_infinite_rule(&rcl_struct, oHigh, nLow);
 	    }
 	    else
-		G_message(_("'%s' is not a valid rule"), buf);
+		G_message(_("%s is not a valid rule"), buf);
 	    break;
 	}			/* switch */
     }				/* loop */

Modified: grass/trunk/raster/r.recode/recode.c
===================================================================
--- grass/trunk/raster/r.recode/recode.c	2008-11-20 21:07:53 UTC (rev 34412)
+++ grass/trunk/raster/r.recode/recode.c	2008-11-20 21:26:40 UTC (rev 34413)
@@ -1,7 +1,4 @@
 #include <stdio.h>
-
-#include <grass/glocale.h>
-
 #include "global.h"
 
 #define F2I(map_type) \
@@ -45,8 +42,7 @@
     /* open the input file for reading */
     in_fd = G_open_cell_old(name, "");
     if (in_fd < 0)
-	G_fatal_error(_("Unable to open raster map <%s>"),
-		      G_fully_qualified_name(name, mapset));
+	G_fatal_error("Can't open input map");
 
     out_fd = G_open_raster_new(result, out_type);
 



More information about the grass-commit mailing list