[GRASS-SVN] r44585 - grass-addons/raster/r.stream.extract
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Dec 11 08:34:08 EST 2010
Author: mmetz
Date: 2010-12-11 05:34:08 -0800 (Sat, 11 Dec 2010)
New Revision: 44585
Modified:
grass-addons/raster/r.stream.extract/close.c
grass-addons/raster/r.stream.extract/del_streams.c
grass-addons/raster/r.stream.extract/do_astar.c
grass-addons/raster/r.stream.extract/load.c
grass-addons/raster/r.stream.extract/main.c
grass-addons/raster/r.stream.extract/streams.c
grass-addons/raster/r.stream.extract/thin.c
Log:
update messages
Modified: grass-addons/raster/r.stream.extract/close.c
===================================================================
--- grass-addons/raster/r.stream.extract/close.c 2010-12-11 13:33:43 UTC (rev 44584)
+++ grass-addons/raster/r.stream.extract/close.c 2010-12-11 13:34:08 UTC (rev 44585)
@@ -30,7 +30,7 @@
double north_offset, west_offset, ns_res, ew_res;
int next_cat;
- G_message(_("write vector maps"));
+ G_message(_("Write vector map <%s>..."), stream_vect);
if (0 > Vect_open_new(&Out, stream_vect, 0)) {
G_fatal_error(_("Unable to create vector map <%s>"), stream_vect);
@@ -138,7 +138,7 @@
}
draindir.pos = INDEX(r_nbr, c_nbr);
if (stream[INDEX(r_nbr, c_nbr)] <= 0)
- G_fatal_error("stream id not set");
+ G_fatal_error(_("BUG: stream id not set"));
Vect_append_point(Points, west_offset + c_nbr * ew_res,
north_offset - r_nbr * ns_res, 0);
@@ -152,7 +152,7 @@
}
G_percent(n_outlets, n_outlets, 1); /* finish it */
- G_message(_("write vector attribute table"));
+ G_message(_("Write vector attribute table"));
/* Prepeare strings for use in db_* calls */
db_init_string(&dbsql);
@@ -210,15 +210,13 @@
}
}
- G_message(_("close vector"));
-
db_commit_transaction(driver);
db_close_database_shutdown_driver(driver);
Vect_map_add_dblink(&Out, 1, NULL, Fi->table,
cat_col_name, Fi->database, Fi->driver);
- G_message(_("close vector"));
+ G_debug(1, "close vector");
Vect_hist_command(&Out);
Vect_build(&Out);
@@ -241,7 +239,8 @@
stream_fd = dir_fd = -1;
cell_buf1 = cell_buf2 = NULL;
- G_message(_("write raster maps"));
+ G_message(_("Write raster %s"),
+ (stream_rast != NULL) + (dir_rast != NULL) > 1 ? "maps" : "map");
/* write requested output rasters */
if (stream_rast) {
Modified: grass-addons/raster/r.stream.extract/del_streams.c
===================================================================
--- grass-addons/raster/r.stream.extract/del_streams.c 2010-12-11 13:33:43 UTC (rev 44584)
+++ grass-addons/raster/r.stream.extract/del_streams.c 2010-12-11 13:34:08 UTC (rev 44585)
@@ -13,7 +13,7 @@
int curr_stream, stream_id, other_trib, tmp_trib;
int slength;
- G_message(_("delete stream segments shorter than %d cells..."), min_length);
+ G_message(_("Delete stream segments shorter than %d cells..."), min_length);
/* go through all nodes */
for (i = 1; i <= n_stream_nodes; i++) {
@@ -71,7 +71,7 @@
}
}
- G_debug(1, "%d stream segments deleted", n_deleted);
+ G_verbose_message(_("%d stream segments deleted"), n_deleted);
return n_deleted;
}
Modified: grass-addons/raster/r.stream.extract/do_astar.c
===================================================================
--- grass-addons/raster/r.stream.extract/do_astar.c 2010-12-11 13:33:43 UTC (rev 44584)
+++ grass-addons/raster/r.stream.extract/do_astar.c 2010-12-11 13:34:08 UTC (rev 44585)
@@ -65,11 +65,11 @@
while (heap_size > 0) {
G_percent(count++, n_points, 1);
if (count > n_points)
- G_fatal_error("broken A* Search, %d surplus points", heap_size);
+ G_fatal_error(_("BUG in A* Search: %d surplus points"), heap_size);
if (heap_size > n_points)
G_fatal_error
- ("broken A* Search, too many points in heap %d, should be %d",
+ (_("BUG in A* Search: too many points in heap %d, should be %d"),
heap_size, n_points);
astp = astar_pts[1];
@@ -217,9 +217,6 @@
heap_size++;
- if (heap_size > n_points)
- G_fatal_error(_("heapsize too large"));
-
astar_added[heap_size] = nxt_avail_pt;
astar_pts[heap_size] = INDEX(r, c);
Modified: grass-addons/raster/r.stream.extract/load.c
===================================================================
--- grass-addons/raster/r.stream.extract/load.c 2010-12-11 13:33:43 UTC (rev 44584)
+++ grass-addons/raster/r.stream.extract/load.c 2010-12-11 13:34:08 UTC (rev 44585)
@@ -40,9 +40,9 @@
DCELL *accp;
if (acc_fd < 0)
- G_message(_("load elevation map and get start points"));
+ G_message(_("Load elevation map and get start points..."));
else
- G_message(_("load input maps and get start points"));
+ G_message(_("Load input maps and get start points..."));
n_search_points = n_points = 0;
@@ -52,7 +52,7 @@
ele_buf = G_allocate_raster_buf(ele_map_type);
if (ele_buf == NULL) {
- G_warning(_("could not allocate memory"));
+ G_warning(_("Could not allocate memory"));
return -1;
}
@@ -61,7 +61,7 @@
acc_size = G_raster_size(acc_map_type);
acc_buf = G_allocate_raster_buf(acc_map_type);
if (acc_buf == NULL) {
- G_warning(_("could not allocate memory"));
+ G_warning(_("Could not allocate memory"));
return -1;
}
}
@@ -83,14 +83,14 @@
G_percent(r, nrows, 2);
if (G_get_raster_row(ele_fd, ele_buf, r, ele_map_type) < 0) {
- G_warning(_("could not read raster maps at row <%d>"), r);
+ G_warning(_("Could not read raster maps at row <%d>"), r);
return -1;
}
ptr = ele_buf;
if (acc_fd >= 0) {
if (G_get_raster_row(acc_fd, acc_buf, r, acc_map_type) < 0) {
- G_warning(_("could not read raster maps at row <%d>"), r);
+ G_warning(_("Could not read raster maps at row <%d>"), r);
return -1;
}
acc_ptr = acc_buf;
@@ -180,14 +180,14 @@
else
depr_buf = NULL;
- G_message(_("set edge points"));
+ G_message(_("Set edge points..."));
loadp = ele;
for (r = 0; r < nrows; r++) {
G_percent(r, nrows, 2);
if (depr_fd >= 0) {
if (G_get_raster_row(depr_fd, depr_buf, r, CELL_TYPE) < 0) {
- G_warning(_("could not read raster map at row <%d>"), r);
+ G_warning(_("Could not read raster map at row <%d>"), r);
return -1;
}
}
@@ -266,7 +266,7 @@
G_free(depr_buf);
}
- G_debug(1, "%d edge cells", heap_size);
+ G_debug(1, "%d edge (and depression) cells", heap_size);
G_debug(1, "%d non-NULL cells", n_points);
return 1;
Modified: grass-addons/raster/r.stream.extract/main.c
===================================================================
--- grass-addons/raster/r.stream.extract/main.c 2010-12-11 13:33:43 UTC (rev 44584)
+++ grass-addons/raster/r.stream.extract/main.c 2010-12-11 13:34:08 UTC (rev 44585)
@@ -225,13 +225,13 @@
mapset = G_find_cell2(input.ele->answer, "");
ele_fd = G_open_cell_old(input.ele->answer, mapset);
if (ele_fd < 0)
- G_fatal_error(_("could not open input map %s"), input.ele->answer);
+ G_fatal_error(_("Could not open input map %s"), input.ele->answer);
if (input.acc->answer) {
mapset = G_find_cell2(input.acc->answer, "");
acc_fd = G_open_cell_old(input.acc->answer, mapset);
if (acc_fd < 0)
- G_fatal_error(_("could not open input map %s"),
+ G_fatal_error(_("Could not open input map %s"),
input.acc->answer);
}
else
@@ -241,7 +241,7 @@
mapset = G_find_cell2(input.depression->answer, "");
depr_fd = G_open_cell_old(input.depression->answer, mapset);
if (depr_fd < 0)
- G_fatal_error(_("could not open input map %s"),
+ G_fatal_error(_("Could not open input map %s"),
input.depression->answer);
}
else
@@ -260,7 +260,7 @@
/* load maps */
if (load_maps(ele_fd, acc_fd, depr_fd) < 0)
- G_fatal_error(_("could not load input map(s)"));
+ G_fatal_error(_("Could not load input map(s)"));
/********************/
/* processing */
@@ -268,35 +268,35 @@
/* sort elevation and get initial stream direction */
if (do_astar() < 0)
- G_fatal_error(_("could not sort elevation map"));
+ G_fatal_error(_("Could not sort elevation map"));
/* extract streams */
if (acc_fd < 0) {
if (do_accum(d8cut) < 0)
- G_fatal_error(_("could not calculate flow accumulation"));
+ G_fatal_error(_("Could not calculate flow accumulation"));
}
stream = (CELL *) G_malloc(nrows * ncols * sizeof(CELL));
if (extract_streams
(threshold, mont_exp, min_stream_length) < 0)
- G_fatal_error(_("could not extract streams"));
+ G_fatal_error(_("Could not extract streams"));
G_free(acc);
/* thin streams */
if (thin_streams() < 0)
- G_fatal_error(_("could not extract streams"));
+ G_fatal_error(_("Could not extract streams"));
/* delete short streams */
if (min_stream_length) {
if (del_streams(min_stream_length) < 0)
- G_fatal_error(_("could not extract streams"));
+ G_fatal_error(_("Could not extract streams"));
}
/* write output maps */
if (close_maps(output.stream_rast->answer, output.stream_vect->answer,
output.dir_rast->answer) < 0)
- G_fatal_error(_("could not write output maps"));
+ G_fatal_error(_("Could not write output maps"));
G_free(ele);
G_free(stream);
Modified: grass-addons/raster/r.stream.extract/streams.c
===================================================================
--- grass-addons/raster/r.stream.extract/streams.c 2010-12-11 13:33:43 UTC (rev 44584)
+++ grass-addons/raster/r.stream.extract/streams.c 2010-12-11 13:34:08 UTC (rev 44585)
@@ -108,7 +108,7 @@
/* debug */
if (n_stream_nodes != *stream_no)
- G_warning(_("stream_no %d and n_stream_nodes %d out of sync"),
+ G_warning(_("BUG: stream_no %d and n_stream_nodes %d out of sync"),
*stream_no, n_stream_nodes);
/* add all tributaries */
@@ -167,12 +167,12 @@
while ((founddir = rbtree_find(draintree, &draindir)) != NULL) {
if (asp_r[(int)founddir->dir] == 0 &&
asp_c[(int)founddir->dir] == 0)
- G_fatal_error("no valid stream direction");
+ G_fatal_error(_("BUG: no valid stream direction"));
r_nbr = r_nbr + asp_r[(int)founddir->dir];
c_nbr = c_nbr + asp_c[(int)founddir->dir];
draindir.pos = INDEX(r_nbr, c_nbr);
if (stream[INDEX(r_nbr, c_nbr)] <= 0)
- G_fatal_error("stream id not set");
+ G_fatal_error(_("BUG: stream id not set"));
else
stream[INDEX(r_nbr, c_nbr)] = curr_stream;
}
@@ -201,7 +201,7 @@
G_debug(2, "%d tribs", stream_node[curr_stream].n_trib);
if (stream_node[curr_stream].n_trib == 1)
- G_warning("stream node %d only 1 trib: %d", curr_stream,
+ G_warning(_("BUG: stream node %d has only 1 tributary: %d"), curr_stream,
stream_node[curr_stream].trib[0]);
return 1;
@@ -231,7 +231,7 @@
int nextdc[8] = { 0, 0, -1, 1, 1, -1, 1, -1 };
unsigned int thisindex, nindex, workedon, killer;
- G_message(_("calculate flow accumulation..."));
+ G_message(_("Calculate flow accumulation..."));
count = 0;
@@ -456,7 +456,7 @@
int stream_no = 0, stream_node_step = 1000;
double slope, diag;
- G_message(_("extract streams..."));
+ G_message(_("Extract streams..."));
/* init BST for drainage direction */
draintree = rbtree_create(draindir_compare, sizeof(struct ddir));
@@ -728,7 +728,7 @@
/* debug */
if (n_stream_nodes != stream_no)
- G_warning(_("stream_no %d and n_stream_nodes %d out of sync"),
+ G_warning(_("BUG: stream_no %d and n_stream_nodes %d out of sync"),
stream_no, n_stream_nodes);
}
Modified: grass-addons/raster/r.stream.extract/thin.c
===================================================================
--- grass-addons/raster/r.stream.extract/thin.c 2010-12-11 13:33:43 UTC (rev 44584)
+++ grass-addons/raster/r.stream.extract/thin.c 2010-12-11 13:34:08 UTC (rev 44585)
@@ -20,7 +20,7 @@
curr_stream = stream[thisindex];
if (curr_stream != stream_id)
- G_fatal_error(_("stream node and stream not identical: stream id %d, stream node id %d, stream %d"),
+ G_fatal_error(_("BUG: stream node and stream not identical: stream id %d, stream node id %d, stream %d"),
stream_id, stream_node[stream_id].id, curr_stream);
draindir.pos = thisindex;
@@ -90,7 +90,7 @@
int top = 0, stack_step = 1000;
int n_trib_total;
- G_message(_("thin stream segments"));
+ G_message(_("Thin stream segments..."));
nodestack = (struct sstack *)G_malloc(stack_step * sizeof(struct sstack));
More information about the grass-commit
mailing list