[GRASS-SVN] r40449 - grass-addons/raster/r.stream.extract
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jan 14 06:33:51 EST 2010
Author: mmetz
Date: 2010-01-14 06:33:49 -0500 (Thu, 14 Jan 2010)
New Revision: 40449
Modified:
grass-addons/raster/r.stream.extract/streams.c
grass-addons/raster/r.stream.extract/thin.c
Log:
flow direction fix and cleaner stream head detection
Modified: grass-addons/raster/r.stream.extract/streams.c
===================================================================
--- grass-addons/raster/r.stream.extract/streams.c 2010-01-14 08:31:37 UTC (rev 40448)
+++ grass-addons/raster/r.stream.extract/streams.c 2010-01-14 11:33:49 UTC (rev 40449)
@@ -575,14 +575,17 @@
is_swale = stream[nindex];
if (is_swale > 0)
swale_cells++;
+
/* check for stream cells */
valued = fabs(acc[nindex]);
- if (valued >= threshold)
+ ele_nbr = ele[nindex];
+ /* if (valued >= threshold) */
+ if (valued >= threshold && ct_dir != np_side &&
+ ele_nbr > ele_val)
stream_cells++;
is_worked = FLAG_GET(worked, r_nbr, c_nbr);
if (is_worked == 0) {
- ele_nbr = ele[nindex];
if (ele_nbr != ele_val)
flat = 0;
edge = G_is_c_null_value(&ele_nbr);
@@ -697,7 +700,7 @@
}
if (is_swale < 1 && flat == 0 && fabs(value) >= threshold &&
- stream_cells < 4 && swale_cells < 1) {
+ stream_cells < 1 && swale_cells < 1) {
G_debug(2, "start new stream");
is_swale = stream[thisindex] = ++stream_no;
/* add stream node */
Modified: grass-addons/raster/r.stream.extract/thin.c
===================================================================
--- grass-addons/raster/r.stream.extract/thin.c 2010-01-14 08:31:37 UTC (rev 40448)
+++ grass-addons/raster/r.stream.extract/thin.c 2010-01-14 11:33:49 UTC (rev 40449)
@@ -55,10 +55,10 @@
draindir.pos = thisindex;
founddir = rbtree_find(draintree, &draindir);
founddir->dir = drain[r - r_nbr + 1][c - c_nbr + 1];
+ asp[draindir.pos] = founddir->dir;
last_r = r_nbr;
last_c = c_nbr;
draindir.pos = INDEX(last_r, last_c);
- asp[draindir.pos] = founddir->dir;
thinned = 1;
}
More information about the grass-commit
mailing list