[GRASS-SVN] r34799 - grass/branches/develbranch_6/imagery/i.maxlik

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 8 07:29:36 EST 2008


Author: martinl
Date: 2008-12-08 07:29:36 -0500 (Mon, 08 Dec 2008)
New Revision: 34799

Modified:
   grass/branches/develbranch_6/imagery/i.maxlik/invert.c
   grass/branches/develbranch_6/imagery/i.maxlik/main.c
   grass/branches/develbranch_6/imagery/i.maxlik/open.c
Log:
i.maxlik: message standardization


Modified: grass/branches/develbranch_6/imagery/i.maxlik/invert.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.maxlik/invert.c	2008-12-08 12:19:03 UTC (rev 34798)
+++ grass/branches/develbranch_6/imagery/i.maxlik/invert.c	2008-12-08 12:29:36 UTC (rev 34799)
@@ -25,10 +25,10 @@
 	stat = invert(s = &S.sig[c], S.nbands, ik, jk, &det);
 	if (stat != 1) {
 	    if (stat)
-		G_warning(_("signature %d is not valid (ill-conditioned) - ignored."),
+		G_warning(_("Signature %d is not valid (ill-conditioned) - ignored"),
 			  c + 1);
 	    else
-		G_warning(_("signature %d is not valid (singular) - ignored."),
+		G_warning(_("Signature %d is not valid (singular) - ignored"),
 			  c + 1);
 
 	    bad = 1;

Modified: grass/branches/develbranch_6/imagery/i.maxlik/main.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.maxlik/main.c	2008-12-08 12:19:03 UTC (rev 34798)
+++ grass/branches/develbranch_6/imagery/i.maxlik/main.c	2008-12-08 12:29:36 UTC (rev 34799)
@@ -11,7 +11,7 @@
  *               Glynn Clements <glynn gclements.plus.com>, 
  *               Jan-Oliver Wagner <jan intevation.de>
  * PURPOSE:      maximum likelihood classification of image groups
- * 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
@@ -60,7 +60,7 @@
     G_gisinit(argv[0]);
 
     module = G_define_module();
-    module->keywords = _("imagery");
+    module->keywords = _("imagery, classification");
     module->label =
 	_("Classifies the cell spectral reflectances in imagery data.");
     module->description =
@@ -68,40 +68,34 @@
 	  "generated by either i.cluster, i.class, or i.gensig.");
 
     parm.group = G_define_standard_option(G_OPT_I_GROUP);
-    parm.group->description = _("Imagery group to be classified");
 
     parm.subgroup = G_define_option();
     parm.subgroup->key = "subgroup";
     parm.subgroup->type = TYPE_STRING;
     parm.subgroup->required = YES;
-    parm.subgroup->description =
-	_("Subgroup containing image files to be classified");
+    parm.subgroup->description = _("Name of subgroup in the above group");
 
-    parm.sigfile = G_define_option();
+    parm.sigfile = G_define_standard_option(G_OPT_F_INPUT);
     parm.sigfile->key = "sigfile";
-    parm.sigfile->type = TYPE_STRING;
     parm.sigfile->required = YES;
-    parm.sigfile->description = _("Signatures to use for classification");
+    parm.sigfile->label = _("Name of file containing signatures");
+    parm.sigfile->description = _("Generated by either i.cluster, i.class, or i.gensig");
 
-    parm.class = G_define_option();
+    parm.class = G_define_standard_option(G_OPT_R_OUTPUT);
     parm.class->key = "class";
-    parm.class->type = TYPE_STRING;
     parm.class->required = YES;
-    parm.class->description = _("Raster map to hold classification results");
+    parm.class->description = _("Name for raster map holding classification results");
 
-    parm.reject = G_define_option();
+    parm.reject = G_define_standard_option(G_OPT_R_OUTPUT);
     parm.reject->key = "reject";
-    parm.reject->type = TYPE_STRING;
     parm.reject->required = NO;
     parm.reject->description =
-	_("Raster map to hold reject threshold results");
+	_("Name for raster map holding reject threshold results");
 
     flag.quiet = G_define_flag();
     flag.quiet->key = 'q';
     flag.quiet->description = _("Run quietly");
 
-    G_disable_interactive();
-
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
@@ -117,25 +111,20 @@
     nrows = G_window_rows();
     ncols = G_window_cols();
 
-    if (!flag.quiet->answer)
-	fprintf(stderr, "%s ... ", G_program_name());
-
     for (row = 0; row < nrows; row++) {
-	if (!flag.quiet->answer)
-	    G_percent(row, nrows, 2);
+	G_percent(row+1, nrows, 2);
 
 	for (band = 0; band < Ref.nfiles; band++)
-	    if (G_get_d_raster_row(cellfd[band], cell[band], row) < 0)	/*fixed 11/99 */
-		exit(EXIT_FAILURE);
-
+	    if (G_get_d_raster_row(cellfd[band], cell[band], row) < 0)
+		G_fatal_error(_("Unable to read raster map row %d"),
+			      row);
+	
 	classify(class_cell, reject_cell, ncols);
 	G_put_raster_row(class_fd, class_cell, CELL_TYPE);
 	if (reject_fd > 0)
 	    G_put_raster_row(reject_fd, reject_cell, CELL_TYPE);
     }
-    if (!flag.quiet->answer)
-	G_percent(row, nrows, 2);
-
+    
     G_close_cell(class_fd);
     if (reject_fd > 0)
 	G_close_cell(reject_fd);
@@ -193,6 +182,5 @@
     I_put_group_ref(group, &group_ref);
     make_history(class_name, group, subgroup, sigfile);
 
-
     exit(EXIT_SUCCESS);
 }

Modified: grass/branches/develbranch_6/imagery/i.maxlik/open.c
===================================================================
--- grass/branches/develbranch_6/imagery/i.maxlik/open.c	2008-12-08 12:19:03 UTC (rev 34798)
+++ grass/branches/develbranch_6/imagery/i.maxlik/open.c	2008-12-08 12:29:36 UTC (rev 34799)
@@ -13,21 +13,21 @@
 
     I_init_group_ref(&Ref);
     if (!I_find_group(group))
-	G_fatal_error(_("group=[%s] - not found."), group);
+	G_fatal_error(_("Group <%s> not found"), group);
 
     if (!I_find_subgroup(group, subgroup))
-	G_fatal_error(_("subgroup=[%s] (of group [%s]) - not found."),
+	G_fatal_error(_("Subgroup <%s> in group <%s> not found"),
 		      subgroup, group);
 
     I_get_subgroup_ref(group, subgroup, &Ref);
 
     if (Ref.nfiles <= 1) {
 	if (Ref.nfiles <= 0)
-	    G_fatal_error(_("Subgroup [%s] of group [%s] doesn't have any files.\n"
-			   "The subgroup must have at least 2 files."));
+	    G_fatal_error(_("Subgroup <%s> of group <%s> doesn't have any raster maps. "
+			    "The subgroup must have at least 2 raster maps."));
 	else
-	    G_fatal_error(_("Subgroup [%s] of group [%s] only has 1 file.\n"
-			    "The subgroup must have at least 2 files."));
+	    G_fatal_error(_("Subgroup <%s> of group <%s> only has 1 raster map. "
+			    "The subgroup must have at least 2 raster maps."));
     }
 
     cell = (DCELL **) G_malloc(Ref.nfiles * sizeof(DCELL *));
@@ -38,21 +38,25 @@
 	name = Ref.file[n].name;
 	mapset = Ref.file[n].mapset;
 	if ((cellfd[n] = G_open_cell_old(name, mapset)) < 0)
-	    exit(EXIT_FAILURE);
+	    G_fatal_error(_("Unable to open raster map <%s>"),
+			  G_fully_qualified_name(name, mapset));
     }
 
     I_init_signatures(&S, Ref.nfiles);
     fd = I_fopen_signature_file_old(group, subgroup, sigfile);
     if (fd == NULL)
-	exit(EXIT_FAILURE);
+	G_fatal_error(_("Unable to open signature file <%s>"),
+		      sigfile);
 
     n = I_read_signatures(fd, &S);
     fclose(fd);
     if (n < 0)
-	G_fatal_error(_("Can't read signature file [%s]."), sigfile);
+	G_fatal_error(_("Unable to read signature file <%s>"),
+		      sigfile);
 
     if (S.nsigs > 255)
-	G_fatal_error(_("[%s] has more than 255 signatures."), sigfile);
+	G_fatal_error(_("<%s> has too many signatures (limit is 255)"),
+		      sigfile);
 
     B = (double *)G_malloc(S.nsigs * sizeof(double));
     invert_signatures();
@@ -67,7 +71,7 @@
     if (reject_name) {
 	reject_fd = G_open_cell_new(reject_name);
 	if (reject_fd < 0)
-	    G_fatal_error(_("Unable to create reject layer [%s]."),
+	    G_fatal_error(_("Unable to create raster map <%s>"),
 			  reject_name);
 	else
 	    reject_cell = G_allocate_cell_buf();



More information about the grass-commit mailing list