[GRASS-SVN] r67299 - grass/trunk/raster/r.stream.extract

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 21 02:07:37 PST 2015


Author: mmetz
Date: 2015-12-21 02:07:37 -0800 (Mon, 21 Dec 2015)
New Revision: 67299

Modified:
   grass/trunk/raster/r.stream.extract/do_astar.c
Log:
r.stream.extract: fix correction for diagonal flow bias

Modified: grass/trunk/raster/r.stream.extract/do_astar.c
===================================================================
--- grass/trunk/raster/r.stream.extract/do_astar.c	2015-12-21 10:06:57 UTC (rev 67298)
+++ grass/trunk/raster/r.stream.extract/do_astar.c	2015-12-21 10:07:37 UTC (rev 67299)
@@ -96,8 +96,8 @@
 			                  dist_to_nbr[ct_dir]);
 	    }
 	    /* avoid diagonal flow direction bias */
-	    if (!is_worked) {
-		if (ct_dir > 3 && slope[ct_dir] >= 0) {
+	    if (!is_in_list || (!is_worked && af.asp < 0)) {
+		if (ct_dir > 3 && slope[ct_dir] > 0) {
 		    if (slope[nbr_ew[ct_dir]] >= 0) {
 			/* slope to ew nbr > slope to center */
 			if (slope[ct_dir] <
@@ -116,17 +116,17 @@
 	    }
 
 	    if (!skip_diag) {
-		if (is_in_list == 0) {
+		if (!is_in_list) {
 		    ele_up = ele_nbr[ct_dir];
 		    af.asp = drain[r_nbr - r + 1][c_nbr - c + 1];
 		    heap_add(r_nbr, c_nbr, ele_up);
 		    FLAG_SET(af.flag, INLISTFLAG);
 		    seg_put(&aspflag, (char *)&af, r_nbr, c_nbr);
 		}
-		else if (is_in_list && is_worked == 0) {
+		else if (!is_worked) {
 		    if (FLAG_GET(af.flag, EDGEFLAG)) {
 			/* neighbour is edge in list, not yet worked */
-			if (af.asp < 0) {
+			if (af.asp < 0 && slope[ct_dir] > 0) {
 			    /* adjust flow direction for edge cell */
 			    af.asp = drain[r_nbr - r + 1][c_nbr - c + 1];
 			    seg_put(&aspflag, (char *)&af, r_nbr, c_nbr);



More information about the grass-commit mailing list