[GRASS-SVN] r57509 - grass-addons/grass6/raster/r.fidimo
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Aug 26 23:39:58 PDT 2013
Author: jradinger
Date: 2013-08-26 23:39:58 -0700 (Mon, 26 Aug 2013)
New Revision: 57509
Modified:
grass-addons/grass6/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/grass6/raster/r.fidimo/r.fidimo.py
===================================================================
--- grass-addons/grass6/raster/r.fidimo/r.fidimo.py 2013-08-27 06:39:12 UTC (rev 57508)
+++ grass-addons/grass6/raster/r.fidimo/r.fidimo.py 2013-08-27 06:39:58 UTC (rev 57509)
@@ -816,12 +816,11 @@
if univar:
upstream_density = float(univar.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 is for coors_barriers (X,Y): "+coors_barriers))
density_for_downstream = upstream_density*(1-passability)
@@ -879,10 +878,6 @@
else:
grass.run_command("r.null", map="density_segment_"+segment_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:
- break
grass.run_command("r.null", map="density_segment_"+segment_cat, null="0") # Final density map per segment
More information about the grass-commit
mailing list