[GRASS-SVN] r34367 - grass/trunk/raster/r.recode
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Nov 18 08:29:03 EST 2008
Author: martinl
Date: 2008-11-18 08:29:03 -0500 (Tue, 18 Nov 2008)
New Revision: 34367
Modified:
grass/trunk/raster/r.recode/main.c
grass/trunk/raster/r.recode/read_rules.c
grass/trunk/raster/r.recode/recode.c
Log:
r.recode: standardize messages
disable interactive mode
(merge from devbr6, r34366)
Modified: grass/trunk/raster/r.recode/main.c
===================================================================
--- grass/trunk/raster/r.recode/main.c 2008-11-18 13:27:00 UTC (rev 34366)
+++ grass/trunk/raster/r.recode/main.c 2008-11-18 13:29:03 UTC (rev 34367)
@@ -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-2006 by the GRASS Development Team
+ * COPYRIGHT: (C) 1999-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
@@ -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");
+ module->keywords = _("raster, recode category");
module->description = _("Recodes categorical raster maps.");
parm.input = G_define_standard_option(G_OPT_R_INPUT);
@@ -56,12 +56,10 @@
parm.output = G_define_standard_option(G_OPT_R_OUTPUT);
- parm.rules = G_define_option();
+ parm.rules = G_define_standard_option(G_OPT_F_INPUT);
parm.rules->key = "rules";
- 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.rules->label = _("File containing recode rules");
+ parm.rules->required = NO;
parm.title = G_define_option();
parm.title->key = "title";
@@ -90,7 +88,7 @@
if (parm.rules->answer) {
srcfp = fopen(parm.rules->answer, "r");
if (!srcfp)
- G_fatal_error(_("Cannot open rules file <%s>"),
+ G_fatal_error(_("Unable to open rules file <%s>"),
parm.rules->answer);
}
@@ -106,5 +104,8 @@
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-18 13:27:00 UTC (rev 34366)
+++ grass/trunk/raster/r.recode/read_rules.c 2008-11-18 13:29:03 UTC (rev 34367)
@@ -16,29 +16,33 @@
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 f_range for map %s"), name);
+ G_fatal_error(_("Unable to read fp range of raster map <%s>"),
+ G_fully_qualified_name(name, mapset));
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_message(_("Data range is empty"));
+ G_important_message(_("Data range of raster map <%s> is empty"),
+ G_fully_qualified_name(name, mapset));
else {
sprintf(buff, "%.10f", old_dmin);
sprintf(buff2, "%.10f", old_dmax);
G_trim_decimal(buff);
G_trim_decimal(buff2);
- G_message(_("Data range of %s is %s to %s (entire map)"), name,
- buff, buff2);
+ G_message(_("Data range of raster map <%s> is %s to %s (entire map)"),
+ G_fully_qualified_name(name, mapset), buff, buff2);
}
}
if (G_read_range(name, "", &range) <= 0)
- G_fatal_error(_("Unable to read range for map <%s>"), name);
+ G_fatal_error(_("Unable to read range of raster map <%s>"),
+ G_fully_qualified_name(name, mapset));
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_message(_("Integer data range of %s is empty"), name);
+ G_important_message(_("Integer data range of raster map <%s> is empty"),
+ G_fully_qualified_name(name, mapset));
else
- G_message(_("Integer data range of %s is %d to %d"),
- name, (int)old_min, (int)old_max);
+ 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);
return 0;
}
@@ -120,7 +124,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-18 13:27:00 UTC (rev 34366)
+++ grass/trunk/raster/r.recode/recode.c 2008-11-18 13:29:03 UTC (rev 34367)
@@ -1,4 +1,7 @@
#include <stdio.h>
+
+#include <grass/glocale.h>
+
#include "global.h"
#define F2I(map_type) \
@@ -42,7 +45,8 @@
/* open the input file for reading */
in_fd = G_open_cell_old(name, "");
if (in_fd < 0)
- G_fatal_error("Can't open input map");
+ G_fatal_error(_("Unable to open raster map <%s>"),
+ G_fully_qualified_name(name, mapset));
out_fd = G_open_raster_new(result, out_type);
More information about the grass-commit
mailing list