Quellcode durchsuchen

Updated documentation. MFD: edge artifacts removed.

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@35641 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz vor 16 Jahren
Ursprung
Commit
e1bfbc640f

+ 17 - 8
raster/r.watershed/front/r.watershed.html

@@ -93,7 +93,7 @@ terrain.
 <dd>The minimum size of an exterior watershed basin in cells, if no flow
 map is input, or overland flow units when a flow map is given.
 Warning: low threshold values will dramactically increase run time and
-generate difficult too read basin and half_basin results.
+generate difficult to read basin and half_basin results.
 This parameter also controls the level of detail in the <em>stream</em>
 segments map.
 
@@ -120,10 +120,10 @@ calculated accurately.
 <dt><em>drainage</em> 
 
 <dd>Output map: drainage direction.  Provides the "aspect" for each
-cell.  Multiplying positive values by 45 will give the direction in
-degrees that the surface runoff will travel from that cell.  The
-value 0 (zero) indicates that the cell is a depression area (defined by
-the depression input map).  Negative values indicate that
+cell measured CCW from East.  Multiplying positive values by 45 will give 
+the direction in degrees that the surface runoff will travel from that 
+cell.  The value 0 (zero) indicates that the cell is a depression area 
+(defined by the depression input map).  Negative values indicate that
 surface runoff is leaving the boundaries of the current geographic
 region.  The absolute value of these negative cells indicates the
 direction of flow.
@@ -139,7 +139,8 @@ in the current geographic region.
 <dt><em>stream</em> 
 
 <dd>Output map: stream segments.  Values correspond to the watershed
-basin values.
+basin values.  Can be vectorized after thinning (<em>r.thin</em>) with 
+<em>r.to.vect</em>.
 
 <dt><em>half_basin</em> 
 
@@ -297,7 +298,7 @@ reduce processing time if the watersheds of interest occupy a small
 percentage of the overall area.
 <p>
 Gaps (NULL cells) in the elevation map that are located within the area 
-of interest will heavily influence flow accumulation: water will 
+of interest will heavily influence the analysis: water will 
 flow into but not out of these gaps. These gaps must be filled beforehand, 
 e.g. with <em>r.fillnulls</em>.
 <p>
@@ -321,7 +322,15 @@ a number of approaches may be considered.
 <p>
 To create <i>river mile</i> segmentation from a vectorized streams map,
 try the <em>v.net.iso</em> or <em>v.lrs.segment</em> modules.
-
+<p>
+The stream segments output can be easily vectorized after thinning with 
+<em>r.thin</em>. Each stream segment in the vector map will have the 
+value of the associated basin. To isolate subbasins and streams for a 
+larger basin, a MASK for the larger basin can be created with 
+<em>r.water.outlet</em>. The stream segments output serves as a guide 
+where to place the outlet point used as input to <em>r.water.outlet</em>. 
+The basin threshold must have been sufficiently small to isolate a 
+stream network and subbasins within the larger basin.
 
 <h2>EXAMPLES</h2>
 <i>These examples use the Spearfish sample dataset.</i>

+ 18 - 3
raster/r.watershed/ram/do_cum.c

@@ -101,8 +101,6 @@ int do_cum_mfd(void)
     CELL is_swale;
     DCELL value, valued;
     int killer, threshold, count;
-    SHORT asp_r[9] = { 0, -1, -1, -1, 0, 1, 1, 1, 0 };
-    SHORT asp_c[9] = { 0, 1, 0, -1, -1, -1, 0, 1, 1 };
 
     /* MFD */
     int mfd_cells, stream_cells, swale_cells, astar_not_set, is_null;
@@ -111,7 +109,9 @@ int do_cum_mfd(void)
     double dx, dy;
     CELL ele, ele_nbr, aspect, is_worked;
     double prop, max_acc;
-    int workedon;
+    int workedon, edge;
+    SHORT asp_r[9] = { 0, -1, -1, -1, 0, 1, 1, 1, 0 };
+    SHORT asp_c[9] = { 0, 1, 0, -1, -1, -1, 0, 1, 1 };
 
     G_message(_("SECTION 3: Accumulating Surface Flow with MFD."));
     G_debug(1, "MFD convergence factor set to %d.", c_fac);
@@ -172,6 +172,7 @@ int do_cum_mfd(void)
 	    astar_not_set = 1;
 	    ele = alt[SEG_INDEX(alt_seg, r, c)];
 	    is_null = 0;
+	    edge = 0;
 	    /* this loop is needed to get the sum of weights */
 	    for (ct_dir = 0; ct_dir < sides; ct_dir++) {
 		/* get r, c (r_nbr, c_nbr) for neighbours */
@@ -194,6 +195,7 @@ int do_cum_mfd(void)
 		    if (is_worked == 0) {
 			ele_nbr = alt[SEG_INDEX(alt_seg, r_nbr, c_nbr)];
 			is_null = G_is_c_null_value(&ele_nbr);
+			edge = is_null;
 			if (!is_null && ele_nbr <= ele) {
 			    if (ele_nbr < ele) {
 				weight[ct_dir] =
@@ -221,6 +223,19 @@ int do_cum_mfd(void)
 		    if (dr == r_nbr && dc == c_nbr)
 			np_side = ct_dir;
 		}
+		else
+		    edge = 1;
+		if (edge)
+		    break;
+	    }
+	    /* do not distribute flow along edges, this causes artifacts */
+	    if (edge) {
+		is_swale = FLAG_GET(swale, r, c);
+		if (is_swale && aspect > 0) {
+		    aspect = -1 * drain[r - r_nbr + 1][c - c_nbr + 1];
+		    asp[SEG_INDEX(asp_seg, r, c)] = aspect;
+		}
+		continue;
 	    }
 
 	    /* honour A * path 

+ 16 - 1
raster/r.watershed/seg/do_cum.c

@@ -114,7 +114,7 @@ int do_cum_mfd(void)
     double dx, dy;
     CELL ele, ele_nbr, asp_val, asp_val2, cvalue, *worked_nbr;
     double prop, max_acc;
-    int workedon;
+    int workedon, edge;
     SHORT asp_r[9] = { 0, -1, -1, -1, 0, 1, 1, 1, 0 };
     SHORT asp_c[9] = { 0, 1, 0, -1, -1, -1, 0, 1, 1 };
 
@@ -187,6 +187,7 @@ int do_cum_mfd(void)
 	    astar_not_set = 1;
 	    cseg_get(&alt, &ele, r, c);
 	    is_null = 0;
+	    edge = 0;
 	    /* this loop is needed to get the sum of weights */
 	    for (ct_dir = 0; ct_dir < sides; ct_dir++) {
 		/* get r, c (r_nbr, c_nbr) for neighbours */
@@ -211,6 +212,7 @@ int do_cum_mfd(void)
 		    if (worked_nbr[ct_dir] == 0) {
 			cseg_get(&alt, &ele_nbr, r_nbr, c_nbr);
 			is_null = G_is_c_null_value(&ele_nbr);
+			edge = is_null;
 			if (!is_null && ele_nbr <= ele) {
 			    if (ele_nbr < ele) {
 				weight[ct_dir] =
@@ -238,6 +240,19 @@ int do_cum_mfd(void)
 		    if (dr == r_nbr && dc == c_nbr)
 			np_side = ct_dir;
 		}
+		else
+		    edge = 1;
+		if (edge)
+		    break;
+	    }
+	    /* do not distribute flow along edges, this causes artifacts */
+	    if (edge) {
+		bseg_get(&swale, &is_swale, r, c);
+		if (is_swale && asp_val > 0) {
+		    asp_val = -1 * drain[r - r_nbr + 1][c - c_nbr + 1];
+		    cseg_put(&asp, &asp_val, r, c);
+		}
+		continue;
 	    }
 
 	    /* honour A * path