[GRASS-SVN] r59425 - grass-addons/grass7/raster/r.stream.stats

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Mar 27 07:48:14 PDT 2014


Author: martinl
Date: 2014-03-27 07:48:13 -0700 (Thu, 27 Mar 2014)
New Revision: 59425

Modified:
   grass-addons/grass7/raster/r.stream.stats/Makefile
   grass-addons/grass7/raster/r.stream.stats/io.c
   grass-addons/grass7/raster/r.stream.stats/io.h
   grass-addons/grass7/raster/r.stream.stats/local_proto.h
   grass-addons/grass7/raster/r.stream.stats/local_vars.h
   grass-addons/grass7/raster/r.stream.stats/main.c
   grass-addons/grass7/raster/r.stream.stats/stats_calculate.c
   grass-addons/grass7/raster/r.stream.stats/stats_prepare.c
Log:
r.stream.stats: more guisection, message correction
                various minor cosmetics


Modified: grass-addons/grass7/raster/r.stream.stats/Makefile
===================================================================
--- grass-addons/grass7/raster/r.stream.stats/Makefile	2014-03-27 14:44:22 UTC (rev 59424)
+++ grass-addons/grass7/raster/r.stream.stats/Makefile	2014-03-27 14:48:13 UTC (rev 59425)
@@ -8,4 +8,3 @@
 include $(MODULE_TOPDIR)/include/Make/Module.make
 
 default: cmd
-

Modified: grass-addons/grass7/raster/r.stream.stats/io.c
===================================================================
--- grass-addons/grass7/raster/r.stream.stats/io.c	2014-03-27 14:44:22 UTC (rev 59424)
+++ grass-addons/grass7/raster/r.stream.stats/io.c	2014-03-27 14:48:13 UTC (rev 59425)
@@ -14,7 +14,7 @@
     int r;
 
     if (data_type < 0 || data_type > 2)
-	G_fatal_error(_("ram_creat: Cannot create map of unrecognised type"));
+	G_fatal_error(_("Unable to create raster map of unrecognised type"));
 
     map->data_type = data_type;
     map->map_name = NULL;
@@ -76,9 +76,9 @@
     if (check_res)
 	if (this_window.ew_res != cellhd.ew_res ||
 	    this_window.ns_res != cellhd.ns_res)
-	    G_fatal_error(_("Region resolution and map %s resolution differs. \
-		Run g.region rast=%s to set proper region resolution"),
-			  input_map_name, input_map_name);
+          G_fatal_error(_("Region resolution and raster map <%s> resolution differs. "
+                          "Run 'g.region rast=%s' to set proper region resolution."),
+                        input_map_name, input_map_name);
 
     /* checking if input map is of required type */
     if (check_data_type != map->data_type)
@@ -87,7 +87,7 @@
     input_data_type = Rast_map_type(input_map_name, mapset);
     if (check_data_type != -1)
 	if (input_data_type != check_data_type)
-	    G_fatal_error(_("<%s> is not of type %s"),
+	    G_fatal_error(_("Raster map <%s> is not of type '%s'"),
 			  input_map_name, maptypes[check_data_type]);
 
     input_map_fd = Rast_open_old(input_map_name, mapset);
@@ -117,7 +117,7 @@
     input_buffer = Rast_allocate_buf(input_data_type);
 
     /* start reading */
-    G_message(_("Reading map <%s>"), input_map_name);
+    G_message(_("Reading raster map <%s>..."), input_map_name);
 
     for (r = 0; r < map->nrows; ++r) {
 	G_percent(r, map->nrows, 2);
@@ -145,7 +145,7 @@
 					 input_data_type);
 		    break;
 		default:
-		    G_fatal_error(_("ram_open:Wrong internal data type"));
+		    G_fatal_error(_("Wrong internal data type"));
 		    break;
 		}
     }				/*end for r */
@@ -192,7 +192,7 @@
 	G_debug(1,
 		"ram_write:required map type and internal map type differs: conversion forced!");
 
-    G_message(_("Writing map <%s>"), output_map_name);
+    G_message(_("Writing raster map <%s>..."), output_map_name);
     output_fd = Rast_open_new(output_map_name, output_data_type);
 
     /* writing */
@@ -229,7 +229,7 @@
     Rast_short_history(output_map_name, "raster", &history);
     Rast_command_history(&history);
     Rast_write_history(output_map_name, &history);
-    G_message(_("<%s> Done"), output_map_name);
+    /*G_message(_("<%s> Done"), output_map_name); */
     return 0;
 }
 
@@ -294,7 +294,7 @@
 	seg->data_size = sizeof(DCELL);
 	break;
     default:
-	G_fatal_error(_("seg_create: unrecognisabe data type"));
+	G_fatal_error(_("Unrecognisable data type"));
     }
 
     filename = G_tempfile();
@@ -305,18 +305,18 @@
 		       seg->data_size)) {
 	close(fd);
 	unlink(filename);
-	G_fatal_error(_("seg_create: cannot format segment"));
+	G_fatal_error(_("Unable to format segment"));
     }
 
     close(fd);
     if (0 > (fd = open(filename, 2))) {
 	unlink(filename);
-	G_fatal_error(_("seg_create: cannot re-open file"));
+	G_fatal_error(_("Unable to re-open file '%s'"), filename);
     }
 
     if (0 > (fd = segment_init(&(seg->seg), fd, number_of_segs))) {
 	unlink(filename);
-	G_fatal_error(_("seg_create: cannot init segment file or out of memory"));
+	G_fatal_error(_("Unable to init segment file or out of memory"));
     }
 
     seg->filename = G_store(filename);
@@ -351,7 +351,7 @@
     /* checking if map exist */
     mapset = (char *)G_find_raster2(input_map_name, "");
     if (mapset == NULL)
-	G_fatal_error(_("seg_read:Raster map <%s> not found"),
+	G_fatal_error(_("Raster map <%s> not found"),
 		      input_map_name);
     seg->mapset = mapset;
 
@@ -363,9 +363,9 @@
     if (check_res)
 	if (this_window.ew_res != cellhd.ew_res ||
 	    this_window.ns_res != cellhd.ns_res)
-	    G_fatal_error(_("Region resolution and map %s resolution differs. \
-		Run g.region rast=%s to set proper region resolution"),
-			  input_map_name, input_map_name);
+          G_fatal_error(_("Region resolution and raster map <%s> resolution differs. "
+                          "Run 'g.region rast=%s' to set proper region resolution."),
+                        input_map_name, input_map_name);
 
     if (check_data_type != seg->data_type)
 	G_debug(1,
@@ -373,7 +373,7 @@
     input_data_type = Rast_map_type(input_map_name, mapset);
     if (check_data_type != -1)
 	if (input_data_type != check_data_type)
-	    G_fatal_error(_("<%s> is not of type %s"),
+	    G_fatal_error(_("Raster <%s> is not of type '%s'"),
 			  input_map_name, maptypes[check_data_type]);
 
     input_fd = Rast_open_old(input_map_name, mapset);
@@ -401,7 +401,7 @@
 
     /* end opening and checking */
 
-    G_message(_("Reading map <%s>"), input_map_name);
+    G_message(_("Reading raster map <%s>..."), input_map_name);
     input_buffer = Rast_allocate_buf(input_data_type);
 
     target_buffer = Rast_allocate_buf(seg->data_type);
@@ -495,7 +495,7 @@
 	G_debug(1,
 		"ram_write:required map type and internal map type differs: conversion forced!");
 
-    G_message(_("Writing map <%s>"), output_map_name);
+    G_message(_("Writing raster map <%s>..."), output_map_name);
     output_fd = Rast_open_new(output_map_name, output_data_type);
     output_buffer = Rast_allocate_buf(output_data_type);
     segment_flush(&(seg->seg));
@@ -505,7 +505,7 @@
 
 	G_percent(r, seg->nrows, 2);
 	if (0 > segment_get_row(&(seg->seg), output_buffer, r))
-	    G_warning(_("seg_write: Cannot segment read row %d for map %s"),
+	    G_warning(_("Unable to segment read row %d for raster map <%s>"),
 		      r, output_map_name);
 
 	if (convert_to_null) {
@@ -541,7 +541,7 @@
     Rast_short_history(output_map_name, "raster", &history);
     Rast_command_history(&history);
     Rast_write_history(output_map_name, &history);
-    G_message(_("%s Done"), output_map_name);
+    /*G_message(_("%s Done"), output_map_name); */
 
     return 0;
 }

Modified: grass-addons/grass7/raster/r.stream.stats/io.h
===================================================================
--- grass-addons/grass7/raster/r.stream.stats/io.h	2014-03-27 14:44:22 UTC (rev 59424)
+++ grass-addons/grass7/raster/r.stream.stats/io.h	2014-03-27 14:48:13 UTC (rev 59425)
@@ -56,4 +56,3 @@
 int seg_reset_map (SEG *, int);
 int seg_write_map(SEG *, char *, RASTER_MAP_TYPE, int, double);
 int seg_release_map(SEG *);
-

Modified: grass-addons/grass7/raster/r.stream.stats/local_proto.h
===================================================================
--- grass-addons/grass7/raster/r.stream.stats/local_proto.h	2014-03-27 14:44:22 UTC (rev 59424)
+++ grass-addons/grass7/raster/r.stream.stats/local_proto.h	2014-03-27 14:48:13 UTC (rev 59425)
@@ -23,4 +23,3 @@
 int print_stats(int order_max);
 int print_stats_total(void);
 int print_stats_orders(int order_max);
-

Modified: grass-addons/grass7/raster/r.stream.stats/local_vars.h
===================================================================
--- grass-addons/grass7/raster/r.stream.stats/local_vars.h	2014-03-27 14:44:22 UTC (rev 59424)
+++ grass-addons/grass7/raster/r.stream.stats/local_vars.h	2014-03-27 14:48:13 UTC (rev 59425)
@@ -61,8 +61,6 @@
 	float drainage_density;
 } STATS;
 
-
-
 #ifdef MAIN
 #	define GLOBAL
 #else
@@ -82,7 +80,3 @@
 GLOBAL STREAM *stat_streams;
 GLOBAL STATS *ord_stats;
 GLOBAL STATS stats_total;
-
-
-
-

Modified: grass-addons/grass7/raster/r.stream.stats/main.c
===================================================================
--- grass-addons/grass7/raster/r.stream.stats/main.c	2014-03-27 14:44:22 UTC (rev 59424)
+++ grass-addons/grass7/raster/r.stream.stats/main.c	2014-03-27 14:48:13 UTC (rev 59425)
@@ -13,11 +13,11 @@
  *               If input stream comes from r.stream.extract direction map 
  *               from r.stream.extract dir map must be patched with that of r.watershed.
  *
- * COPYRIGHT:    (C) 2002,2010 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2002,2010-2014 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
- *   	    	 	  for details.
+ *   	    	 License (>=v2). Read the file COPYING that comes with GRASS
+ *   	    	 for details.
  *
  *****************************************************************************/
 #define MAIN
@@ -49,33 +49,29 @@
     /* initialize module */
     module = G_define_module();
     module->description =
-	_("Calculate Horton's statistics for Strahler and Horton ordered networks created with r.stream.order");
+	_("Calculates Horton's statistics for Strahler and Horton ordered networks created with r.stream.order.");
     G_add_keyword(_("raster"));
     G_add_keyword(_("hydrology"));
-    G_add_keyword("Horton's statistics");
-    G_add_keyword("Bifurcation ratio");
-    G_add_keyword("Drainage density");
-    G_add_keyword("Catchment statistics");
+    G_add_keyword(_("stream network"));
+    G_add_keyword(_("Horton's statistics"));
 
     in_stm_opt = G_define_standard_option(G_OPT_R_INPUT);
     in_stm_opt->key = "streams";
-    in_stm_opt->description = "Name of streams mask input map";
+    in_stm_opt->description = _("Name of input streams mask raster map");
 
     in_dir_opt = G_define_standard_option(G_OPT_R_INPUT);
     in_dir_opt->key = "dirs";
-    in_dir_opt->description = "Name of flow direction input map";
+    in_dir_opt->description = _("Name of input flow direction raster map");
 
-    in_elev_opt = G_define_standard_option(G_OPT_R_INPUT);
-    in_elev_opt->key = "elevation";
-    in_elev_opt->description = "Name of elevation map";
+    in_elev_opt = G_define_standard_option(G_OPT_R_ELEV);
 
     opt_swapsize = G_define_option();
     opt_swapsize->key = "memory";
     opt_swapsize->type = TYPE_INTEGER;
     opt_swapsize->answer = "300";
     opt_swapsize->description = _("Max memory used in memory swap mode (MB)");
-    opt_swapsize->guisection = _("Optional");
-
+    opt_swapsize->guisection = _("Memory settings");
+    
     opt_output = G_define_standard_option(G_OPT_F_OUTPUT);
     opt_output->required = NO;
     opt_output->description =
@@ -84,15 +80,18 @@
     flag_segmentation = G_define_flag();
     flag_segmentation->key = 'm';
     flag_segmentation->description = _("Use memory swap (operation is slow)");
+    flag_segmentation->guisection = _("Memory settings");
 
     flag_catchment_total = G_define_flag();
     flag_catchment_total->key = 'c';
     flag_catchment_total->description =
 	_("Print only catchment's statistics");
+    flag_catchment_total->guisection = _("Print");
 
     flag_orders_summary = G_define_flag();
     flag_orders_summary->key = 'o';
     flag_orders_summary->description = _("Print only orders' statistics");
+    flag_orders_summary->guisection = _("Print");
 
     if (G_parser(argc, argv))	/* parser */
 	exit(EXIT_FAILURE);
@@ -104,7 +103,7 @@
     filename = opt_output->answer;
     if (filename != NULL)
 	if (NULL == freopen(filename, "w", stdout))
-	    G_fatal_error(_("Unable to open file <%s> for writing"),
+	    G_fatal_error(_("Unable to open file '%s' for writing"),
 			  filename);
 
     nrows = Rast_window_rows();
@@ -115,7 +114,7 @@
 	CELL **streams, **dirs;
 	FCELL **elevation;
 
-	G_message(_("ALL IN RAM CALCULATION"));
+	G_message(_("All in RAM calculation..."));
 
 	ram_create_map(&map_streams, CELL_TYPE);
 	ram_read_map(&map_streams, in_stm_opt->answer, 1, CELL_TYPE);
@@ -153,7 +152,7 @@
 	SEG map_dirs, map_streams, map_elevation;
 	SEGMENT *streams, *dirs, *elevation;
 
-	G_message(_("MEMORY SWAP CALCULATION - MAY TAKE SOME TIME"));
+        G_message(_("Memory swap calculation (may take some time)..."));
 
 	number_of_segs = (int)atof(opt_swapsize->answer);
 	number_of_segs = number_of_segs < 32 ? (int)(32 / 0.18) : number_of_segs / 0.18;

Modified: grass-addons/grass7/raster/r.stream.stats/stats_calculate.c
===================================================================
--- grass-addons/grass7/raster/r.stream.stats/stats_calculate.c	2014-03-27 14:44:22 UTC (rev 59424)
+++ grass-addons/grass7/raster/r.stream.stats/stats_calculate.c	2014-03-27 14:48:13 UTC (rev 59425)
@@ -27,7 +27,7 @@
     return result;
 }
 
-int stats(order_max)
+int stats(int order_max)
 {
     int i;
     int num, ord_num;

Modified: grass-addons/grass7/raster/r.stream.stats/stats_prepare.c
===================================================================
--- grass-addons/grass7/raster/r.stream.stats/stats_prepare.c	2014-03-27 14:44:22 UTC (rev 59424)
+++ grass-addons/grass7/raster/r.stream.stats/stats_prepare.c	2014-03-27 14:48:13 UTC (rev 59425)
@@ -4,7 +4,7 @@
 int fifo_insert(POINT point)
 {
     if (fifo_count == fifo_max)
-	G_fatal_error("fifo queue: circular buffer too small");
+        G_fatal_error(_("Circular buffer too small"));
 
     fifo_points[tail++] = point;
     if (tail > fifo_max) {



More information about the grass-commit mailing list