[GRASS-SVN] r70837 - grass-addons/grass7/raster/r.diversity

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Apr 4 18:27:11 PDT 2017


Author: annakrat
Date: 2017-04-04 18:27:11 -0700 (Tue, 04 Apr 2017)
New Revision: 70837

Modified:
   grass-addons/grass7/raster/r.diversity/r.diversity.py
Log:
r.diversity: allow using float for alpha

Modified: grass-addons/grass7/raster/r.diversity/r.diversity.py
===================================================================
--- grass-addons/grass7/raster/r.diversity/r.diversity.py	2017-04-04 20:56:54 UTC (rev 70836)
+++ grass-addons/grass7/raster/r.diversity/r.diversity.py	2017-04-05 01:27:11 UTC (rev 70837)
@@ -259,10 +259,10 @@
     # transform string to int and check if is a odd number
     for i in range(len(reso)):
         # check if is a odd number
-        reso[i] = int(reso[i])
-        if reso[i] % 2 == 0:
+        reso[i] = float(reso[i]) if alpha else int(reso[i])
+        if not alpha and reso[i] % 2 == 0:
             # return the error advice
-            grass.fatal(_("The size/alpha setting must be an odd number " \
+            grass.fatal(_("The size setting must be an odd number " \
                           "(found %d)" % reso[i]))
     # create a range
     if typ == 'range':



More information about the grass-commit mailing list