[GRASS-SVN] r71362 - in grass-addons/grass7/raster: r.hypso r.width.funct

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 10 00:59:03 PDT 2017


Author: madi
Date: 2017-08-10 00:59:03 -0700 (Thu, 10 Aug 2017)
New Revision: 71362

Modified:
   grass-addons/grass7/raster/r.hypso/r.hypso.py
   grass-addons/grass7/raster/r.width.funct/r.width.funct.py
Log:
fixed problem parsing pixel size

Modified: grass-addons/grass7/raster/r.hypso/r.hypso.py
===================================================================
--- grass-addons/grass7/raster/r.hypso/r.hypso.py	2017-08-10 07:17:10 UTC (rev 71361)
+++ grass-addons/grass7/raster/r.hypso/r.hypso.py	2017-08-10 07:59:03 UTC (rev 71362)
@@ -59,7 +59,7 @@
     stats = grass.read_command('r.stats', input = options['map'], sep = 'space', nv = '*', nsteps = '255', flags = 'inc').split('\n')[:-1]
 
     # res = cellsize
-    res = float(grass.read_command('g.region', raster = options['map'], flags = 'm').strip().split('\n')[4].split('=')[1])
+    res = float(grass.read_command('g.region', raster = options['map'], flags = 'm').strip().split('\n')[6].split('=')[1])
     zn = np.zeros((len(stats),6),float)
     kl = np.zeros((len(stats),2),float)
     prc = np.zeros((9,2),float)
@@ -123,7 +123,7 @@
     z1 = kl[Xf][0]
     z2 = kl[Xf-1][0]
     f1 = kl[Xf][1]
-    f2 = kl[Xf-1][1] 
+    f2 = kl[Xf-1][1]
     z = z1 + ((z2 - z1) / (f2 - f1)) * (f - f1)
     return z
 

Modified: grass-addons/grass7/raster/r.width.funct/r.width.funct.py
===================================================================
--- grass-addons/grass7/raster/r.width.funct/r.width.funct.py	2017-08-10 07:17:10 UTC (rev 71361)
+++ grass-addons/grass7/raster/r.width.funct/r.width.funct.py	2017-08-10 07:59:03 UTC (rev 71362)
@@ -52,7 +52,9 @@
     stats = grass.read_command('r.stats', input = options['map'], sep = 'space', nv = '*', nsteps = '255', flags = 'Anc').split('\n')[:-1]
 
     # res = cellsize
-    res = float(grass.read_command('g.region', raster = options['map'], flags = 'm').strip().split('\n')[4].split('=')[1])
+    res1 = grass.read_command('g.region', raster = options['map'], flags = 'm')
+    res = int(res1.strip().split('\n')[6].split('=')[1])
+
     zn = np.zeros((len(stats),4),float)
     kl = np.zeros((len(stats),2),float)
     prc = np.zeros((9,2),float)



More information about the grass-commit mailing list