[GRASS-SVN] r71535 - grass-addons/grass7/raster/r.tri

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Oct 7 10:42:57 PDT 2017


Author: spawley
Date: 2017-10-07 10:42:57 -0700 (Sat, 07 Oct 2017)
New Revision: 71535

Modified:
   grass-addons/grass7/raster/r.tri/r.tri.py
Log:
Bug fix to ensure that terrain ruggedness output is float

Modified: grass-addons/grass7/raster/r.tri/r.tri.py
===================================================================
--- grass-addons/grass7/raster/r.tri/r.tri.py	2017-10-07 17:37:39 UTC (rev 71534)
+++ grass-addons/grass7/raster/r.tri/r.tri.py	2017-10-07 17:42:57 UTC (rev 71535)
@@ -38,7 +38,6 @@
 #%end
 
 import sys
-import os
 import grass.script as gs
 
 def main():
@@ -64,11 +63,11 @@
     terms = ["abs($dem - $dem[%d,%d])" % d for d in offsets]
 
     # define the calculation expression
-    expr = "$tri = (%s" % " + ".join(terms) + ") / $neighcells"
+    expr = "$tri = float(%s" % " + ".join(terms) + ") / $neighcells"
 
     # perform the r.mapcalc calculation with the moving window
     gs.mapcalc(expr, tri=tri, dem=dem, neighcells=neighcells)
-    
+
     return 0
 
 if __name__ == "__main__":



More information about the grass-commit mailing list