[GRASS-SVN] r42238 - grass/trunk/raster/r.watershed/ram
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed May 12 08:12:30 EDT 2010
Author: mmetz
Date: 2010-05-12 08:12:29 -0400 (Wed, 12 May 2010)
New Revision: 42238
Modified:
grass/trunk/raster/r.watershed/ram/do_flatarea.c
grass/trunk/raster/r.watershed/ram/init_vars.c
Log:
finetune flat area beautification
Modified: grass/trunk/raster/r.watershed/ram/do_flatarea.c
===================================================================
--- grass/trunk/raster/r.watershed/ram/do_flatarea.c 2010-05-12 09:53:37 UTC (rev 42237)
+++ grass/trunk/raster/r.watershed/ram/do_flatarea.c 2010-05-12 12:12:29 UTC (rev 42238)
@@ -156,8 +156,6 @@
seg_index_rc(alt_seg, index_doer, &r, &c);
- FLAG_SET(flat_done, r, c);
-
/* check all neighbours, breadth first search */
for (ct_dir = 0; ct_dir < sides; ct_dir++) {
/* get r, c (upr, upc) for this neighbour */
@@ -354,7 +352,6 @@
pq_add(index_up, up_pq);
/* unset flag */
nbr_order_found->flag = 0;
- //nbr_order_found->downhill = 0;
}
}
}
@@ -375,6 +372,8 @@
seg_index_rc(alt_seg, index_doer, &r, &c);
this_in_list = FLAG_GET(in_list, r, c);
+ FLAG_SET(flat_done, r, c);
+
/* get uphill and downhill order for this point */
inc_order.index = index_doer;
if ((order_found = rbtree_find(order_tree, &inc_order)) == NULL)
@@ -394,7 +393,7 @@
downhill_order = max_downhill_order;
uphill_order = 0;
}
- alt[index_doer] += uphill_order + max_downhill_order - downhill_order;
+ alt[index_doer] += uphill_order + (double)(max_downhill_order - downhill_order) / 2.0 + 0.5;
/* check all neighbours, breadth first search */
for (ct_dir = 0; ct_dir < sides; ct_dir++) {
Modified: grass/trunk/raster/r.watershed/ram/init_vars.c
===================================================================
--- grass/trunk/raster/r.watershed/ram/init_vars.c 2010-05-12 09:53:37 UTC (rev 42237)
+++ grass/trunk/raster/r.watershed/ram/init_vars.c 2010-05-12 12:12:29 UTC (rev 42238)
@@ -159,6 +159,8 @@
if (ele_map_type == FCELL_TYPE || ele_map_type == DCELL_TYPE)
ele_scale = 10000; /* should be enough to do the trick */
+ if (flat_flag)
+ ele_scale = 10000;
/* read elevation input and mark NULL/masked cells */
/* intialize accumulation and drainage direction */
@@ -186,6 +188,7 @@
else {
if (ele_map_type == CELL_TYPE) {
alt_value = *((CELL *)ptr);
+ alt_value *= ele_scale;
}
else if (ele_map_type == FCELL_TYPE) {
dvalue = *((FCELL *)ptr);
More information about the grass-commit
mailing list