[GRASS-SVN] r63301 - grass-addons/grass7/vector/v.habitat.dem

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Nov 30 06:48:24 PST 2014


Author: hellik
Date: 2014-11-30 06:48:24 -0800 (Sun, 30 Nov 2014)
New Revision: 63301

Modified:
   grass-addons/grass7/vector/v.habitat.dem/v.habitat.dem.py
Log:
v.habitat.dem: fix alignment to raster and vector

Modified: grass-addons/grass7/vector/v.habitat.dem/v.habitat.dem.py
===================================================================
--- grass-addons/grass7/vector/v.habitat.dem/v.habitat.dem.py	2014-11-30 13:50:20 UTC (rev 63300)
+++ grass-addons/grass7/vector/v.habitat.dem/v.habitat.dem.py	2014-11-30 14:48:24 UTC (rev 63301)
@@ -177,7 +177,10 @@
     grass.message( "----" )
 	
     # Print and save current region
-    grass.run_command('g.region', flags = 'p', save = saved_region, overwrite = True)
+    grass.message( "Current region:" )
+    grass.message( "n, s, e, w" )
+    grass.message( [current_region[key] for key in "nsew"] )
+    grass.run_command('g.region', save = saved_region, overwrite = True)
     grass.message( "Current region saved." )	
     grass.message( "----" )
 	
@@ -188,24 +191,34 @@
                                      vect = v_habitat,
                                      align = r_elevation)
     grass.message( "Alignment done." )	
+
+    aligned_region = grass.region()
+    Naligned = aligned_region["n"]
+    Saligned = aligned_region["s"]
+    Ealigned = aligned_region["e"]
+    Waligned = aligned_region["w"]
+
+    grass.message( "Aligned region:" )
+    grass.message( "n, s, e, w" )
+    grass.message( [aligned_region[key] for key in "nsew"] )
     grass.message( "----" )									 
 									 
     # Extend region
-    grass.message( "Extend region ..." )
-    grass.message( "n, s, e, w" )
-    grass.message( [current_region[key] for key in "nsew"] )
-    grass.message( "by" )
+    grass.message( "Extend region by" )
     grass.message( regext )
     grass.message( "in all directions" )
 	
-    grass.run_command('g.region', n = N+X,
-                                     s = S-X,
-                                     e = E+X,
-                                     w = W-X)
+    grass.run_command('g.region', n = Naligned+X,
+                                     s = Saligned-X,
+                                     e = Ealigned+X,
+                                     w = Waligned-X)
     grass.message( "Region extension done." )
+
+    extended_region = grass.region()
 	
     grass.message( "Extended region:" )
-    grass.run_command('g.region', flags = 'p')
+    grass.message( "n, s, e, w" )
+    grass.message( [extended_region[key] for key in "nsew"] )
     grass.message( "----" )
 	
     # Watershed calculation: accumulation, drainage direction, topographic index



More information about the grass-commit mailing list