[GRASS-SVN] r57481 - grass-addons/grass6/raster/r.fidimo

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 21 23:59:00 PDT 2013


Author: jradinger
Date: 2013-08-21 23:58:59 -0700 (Wed, 21 Aug 2013)
New Revision: 57481

Modified:
   grass-addons/grass6/raster/r.fidimo/r.fidimo.py
Log:
Additional (Correction) small changes related to small (1-cell) tributaries (see last rev) for cases where the buffer-drainage method produces artefacts of 1-cell tribuatries

Modified: grass-addons/grass6/raster/r.fidimo/r.fidimo.py
===================================================================
--- grass-addons/grass6/raster/r.fidimo/r.fidimo.py	2013-08-21 18:57:06 UTC (rev 57480)
+++ grass-addons/grass6/raster/r.fidimo/r.fidimo.py	2013-08-22 06:58:59 UTC (rev 57481)
@@ -187,7 +187,7 @@
 	global tmp_map_rast
 	global tmp_map_vect
 
-	tmp_map_rast = ['density_final_','density_final_corrected_','density_from_point_tmp_', 'density_from_point_unmasked_tmp_', 'distance_from_point_tmp_', 'distance_raster_tmp_','distance_raster_buffered_tmp_','distance_raster_grow_tmp_','division_overlay_tmp_', 'downstream_drain_tmp_','drainage_tmp_','flow_direction_tmp_', 'lower_distance_tmp_', 'rel_upstream_shreve_tmp_', 'river_raster_cat_tmp_', 'river_raster_tmp_', 'river_raster_buffer_tmp_', 'river_raster_grow_start_tmp_', 'river_raster_nearest_tmp_', 'shreve_tmp_', 'source_populations_scalar_','source_populations_scalar_corrected_', 'strahler_tmp_', 'stream_segments_tmp_', 'upper_distance_tmp_', 'upstream_part_tmp_', 'upstream_shreve_tmp_']
+	tmp_map_rast = ['density_final_','density_final_corrected_','density_from_point_tmp_', 'density_from_point_unmasked_tmp_', 'distance_from_point_tmp_', 'distance_raster_tmp_','distance_raster_buffered_tmp_','distance_raster_grow_tmp_','division_overlay_tmp_', 'downstream_drain_tmp_','drainage_tmp_','flow_direction_tmp_', 'lower_distance_tmp_', 'rel_upstream_shreve_tmp_', 'river_raster_cat_tmp_', 'river_raster_tmp_', 'river_raster_combine_tmp_', 'river_raster_buffer_tmp_', 'river_raster_grow_start_tmp_', 'river_raster_nearest_tmp_', 'shreve_tmp_', 'source_populations_scalar_','source_populations_scalar_corrected_', 'strahler_tmp_', 'stream_segments_tmp_', 'upper_distance_tmp_', 'upstream_part_tmp_', 'upstream_shreve_tmp_']
 
 
 	tmp_map_vect = ['river_points_tmp_', 'river_vector_tmp_', 'river_vector_nocat_tmp_','source_points_']
@@ -455,11 +455,15 @@
 							drainage_tmp = "drainage_tmp_%d" % os.getpid())
 
 	# Stream segments depicts new river_raster (corrected for small tributaries of 1 cell)	
-	grass.mapcalc("$river_raster_tmp = if($stream_segments_tmp,$res*1.0)",
+	grass.mapcalc("$river_raster_combine_tmp = if($stream_segments_tmp && $river_raster_tmp,$res*1.0)",
+							river_raster_combine_tmp =  "river_raster_combine_tmp_%d" % os.getpid(),
 							river_raster_tmp =  "river_raster_tmp_%d" % os.getpid(),
 							stream_segments_tmp = "stream_segments_tmp_%d" % os.getpid(),
 							res = res)
 
+	grass.run_command("g.copy",
+					overwrite=True, 
+					rast = "river_raster_combine_tmp_%d" % os.getpid() + "," "river_raster_tmp_%d" % os.getpid())
 
 	#Calculation of stream order (Shreve/Strahler)
 	grass.run_command("r.stream.order",



More information about the grass-commit mailing list