[GRASS-SVN] r44613 - grass-addons/raster/r.stream.extract

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 16 08:48:40 EST 2010


Author: mmetz
Date: 2010-12-16 05:48:40 -0800 (Thu, 16 Dec 2010)
New Revision: 44613

Modified:
   grass-addons/raster/r.stream.extract/load.c
   grass-addons/raster/r.stream.extract/streams.c
Log:
fix drainage direction and always mark as processed

Modified: grass-addons/raster/r.stream.extract/load.c
===================================================================
--- grass-addons/raster/r.stream.extract/load.c	2010-12-15 23:21:34 UTC (rev 44612)
+++ grass-addons/raster/r.stream.extract/load.c	2010-12-16 13:48:40 UTC (rev 44613)
@@ -236,7 +236,7 @@
 		is_worked = FLAG_GET(worked, r_nbr, c_nbr);
 
 		if (is_worked) {
-		    asp_value = drain[r - r_nbr + 1][c - c_nbr + 1];
+		    asp_value = -drain[r - r_nbr + 1][c - c_nbr + 1];
 		    thisindex = INDEX(r, c);
 		    ele_value = ele[thisindex];
 		    asp[thisindex] = asp_value;

Modified: grass-addons/raster/r.stream.extract/streams.c
===================================================================
--- grass-addons/raster/r.stream.extract/streams.c	2010-12-15 23:21:34 UTC (rev 44612)
+++ grass-addons/raster/r.stream.extract/streams.c	2010-12-16 13:48:40 UTC (rev 44613)
@@ -457,7 +457,7 @@
     double slope, diag;
 
     G_message(_("Extract streams..."));
-
+    
     /* init BST for drainage direction */
     draintree = rbtree_create(draindir_compare, sizeof(struct ddir));
 
@@ -516,6 +516,8 @@
 	c = thisindex - r * ncols;
 	aspect = asp[thisindex];
 
+	FLAG_SET(worked, r, c);
+
 	/* do not distribute flow along edges */
 	if (aspect <= 0) {
 	    G_debug(3, "edge");
@@ -534,7 +536,7 @@
 		outlets[n_outlets].c = c;
 		n_outlets++;
 	    }
-	    FLAG_SET(worked, r, c);
+
 	    if (aspect == 0) {
 		/* can only happen with real depressions */
 		if (!have_depressions)
@@ -757,8 +759,6 @@
 				&stream_no, min_length);
 	    }
 	}
-
-	FLAG_SET(worked, r, c);
     }
     if (workedon)
 	G_warning(_("MFD: A * path already processed when distributing flow: %d of %d cells"),



More information about the grass-commit mailing list