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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jun 10 06:42:15 PDT 2014


Author: lucadelu
Date: 2014-06-10 06:42:15 -0700 (Tue, 10 Jun 2014)
New Revision: 60779

Modified:
   grass-addons/grass7/raster/r.diversity/r.diversity.py
Log:
fix problem on windows; add flag to maintain r.li configuration file

Modified: grass-addons/grass7/raster/r.diversity/r.diversity.py
===================================================================
--- grass-addons/grass7/raster/r.diversity/r.diversity.py	2014-06-10 08:01:48 UTC (rev 60778)
+++ grass-addons/grass7/raster/r.diversity/r.diversity.py	2014-06-10 13:42:15 UTC (rev 60779)
@@ -72,8 +72,11 @@
 #% description: Exclude methods
 #% required: no
 #%end
+#%flag
+#% key: t
+#% description: Preserve configuration files
+#%end
 
-
 # import library
 import os
 import sys
@@ -145,7 +148,8 @@
         calculateE(rlidir, map_in, map_out, resolution, alpha_value, excludes,
                    quiet, overwrite)
     # remove configuration files
-    removeConfFile(resolution, rlidir)
+    if not flags['t']:
+        removeConfFile(resolution, rlidir)
     grass.message(_("Done."))
 
 
@@ -231,7 +235,7 @@
     outputLine.append('SAMPLEAREA -1|-1|' + str(rV) + '|' + str(cV) + '\n')
     outputLine.append('MOVINGWINDOW\n')
     # open configuration file
-    fileConf = open(confilename, 'w')
+    fileConf = open(confilename, 'wb')
     # write file
     fileConf.writelines(outputLine)
     # close file



More information about the grass-commit mailing list