[GRASS-SVN] r64502 - in grass-addons/grass7/raster: r.stream.distance r.stream.order

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Feb 7 14:30:52 PST 2015


Author: mmetz
Date: 2015-02-07 14:30:52 -0800 (Sat, 07 Feb 2015)
New Revision: 64502

Modified:
   grass-addons/grass7/raster/r.stream.distance/distance_calc.c
   grass-addons/grass7/raster/r.stream.order/stream_topology.c
Log:
r.stream.*: sync ram and seg mode

Modified: grass-addons/grass7/raster/r.stream.distance/distance_calc.c
===================================================================
--- grass-addons/grass7/raster/r.stream.distance/distance_calc.c	2015-02-07 21:41:57 UTC (rev 64501)
+++ grass-addons/grass7/raster/r.stream.distance/distance_calc.c	2015-02-07 22:30:52 UTC (rev 64502)
@@ -36,7 +36,7 @@
     POINT n_cell;
     double cur_dist = 0;
     double tmp_dist = 0;
-    double target_elev;		/* elevation at stream or outlet */
+    DCELL target_elev;		/* elevation at stream or outlet */
     double easting, northing;
     double cell_easting, cell_northing;
     struct Cell_head window;
@@ -139,7 +139,7 @@
     POINT n_cell;
     double cur_dist = 0;
     double tmp_dist = 0;
-    double target_elev;		/* eleavation at stream or outlet */
+    DCELL target_elev;		/* elevation at stream or outlet */
     double easting, northing;
     double cell_easting, cell_northing;
     CELL dirs_cell;
@@ -158,6 +158,8 @@
 	Segment_get(elevation, &target_elev, r, c);
 	Segment_put(elevation, &zero_cell, r, c);
     }
+    else
+	Rast_set_d_null_value(&target_elev, 1);
 
     while (tail != head) {
 	easting = window.west + (c + .5) * window.ew_res;
@@ -535,13 +537,10 @@
 
 	    Segment_get(distance, &distance_cell, r, c);
 	    Segment_get(dirs, &dirs_cell, r, c);
-	    if (distance_cell == 1) {
-		if (distance_cell == 1 && dirs_cell > 0)
-		    n_inits++;
-		else if (dirs_cell > 0)
-		    Segment_put(distance, &minus_one_cell, r, c);
-	    }
-
+	    if (distance_cell == 1 && dirs_cell > 0)
+		n_inits++;
+	    else if (dirs_cell > 0)
+		Segment_put(distance, &minus_one_cell, r, c);
 	}
     }
 

Modified: grass-addons/grass7/raster/r.stream.order/stream_topology.c
===================================================================
--- grass-addons/grass7/raster/r.stream.order/stream_topology.c	2015-02-07 21:41:57 UTC (rev 64501)
+++ grass-addons/grass7/raster/r.stream.order/stream_topology.c	2015-02-07 22:30:52 UTC (rev 64502)
@@ -372,7 +372,7 @@
 	    next_r = NR(d);
 	    next_c = NC(d);
 	    if (NOT_IN_REGION(d))
-		Rast_set_c_null_value(&next_stream, 1);
+		next_stream = 0;
 	    else
 		Segment_get(streams, &next_stream, next_r, next_c);
 



More information about the grass-commit mailing list