[GRASS-SVN] r57508 - grass-addons/grass7/raster/r.fidimo

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 26 23:39:14 PDT 2013


Author: jradinger
Date: 2013-08-26 23:39:12 -0700 (Mon, 26 Aug 2013)
New Revision: 57508

Modified:
   grass-addons/grass7/raster/r.fidimo/r.fidimo.py
Log:
Changes for barriers: If there is no upstream density then continue with next barrier in loop. Removal of break in barrier loop as the break may produce incorrect results

Modified: grass-addons/grass7/raster/r.fidimo/r.fidimo.py
===================================================================
--- grass-addons/grass7/raster/r.fidimo/r.fidimo.py	2013-08-26 12:44:38 UTC (rev 57507)
+++ grass-addons/grass7/raster/r.fidimo/r.fidimo.py	2013-08-27 06:39:12 UTC (rev 57508)
@@ -814,14 +814,11 @@
 						if univar_upstream_barrier_density:
 							sum_upstream_barrier_density = float(univar_upstream_barrier_density.split('\n')[d['sum']].split(':')[1])
 						else:
-							grass.run_command("g.copy", overwrite=True, rast="upstream_density_tmp_%d,erroneous_upstream_density" % os.getpid())
-							grass.run_command("g.copy", overwrite=True, rast="upstream_barrier_tmp_%d,erroneous_upstream_barrier" % os.getpid())
-							grass.run_command("g.copy", overwrite=True, rast="density_segment_"+segment_cat+",erroneous_density_segment_"+segment_cat)
-							grass.run_command("g.copy", overwrite=True, rast="flow_direction_tmp_%d,erroneous_flow_direction" % os.getpid())
+							# if no upstream density to allocate than stop that "barrier-loop" and contiue with next barrier
+							grass.message(_("No upstream denisty to allocate downstream for that barrier: "+coors_barriers))
+							continue							
+		
 
-							grass.fatal(_("Error with upstream density/barriers. The error occurs for coors_barriers (X,Y): "+coors_barriers))		
-
-
 						density_for_downstream = sum_upstream_barrier_density*(1-passability)
 				
 	
@@ -881,11 +878,6 @@
 						else:
 							grass.run_command("r.null", map="density_"+str(cat), setnull="0")
 					
-						#If the barrier in the loop was impermeable (passability=0) 
-						#than no more upstream barriers need to be considered --> break
-						if passability == 0:
-							grass.run_command("r.null", map="density_"+str(cat), null="0")
-							break
 
 
 				# Get a list of all densities processed so far within this segement



More information about the grass-commit mailing list