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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 18 07:19:39 EST 2011


Author: lucadelu
Date: 2011-01-18 04:19:39 -0800 (Tue, 18 Jan 2011)
New Revision: 45077

Modified:
   grass-addons/raster/r.diversity/r.diversity.py
Log:
solve a small bug in the name variable

Modified: grass-addons/raster/r.diversity/r.diversity.py
===================================================================
--- grass-addons/raster/r.diversity/r.diversity.py	2011-01-18 10:40:02 UTC (rev 45076)
+++ grass-addons/raster/r.diversity/r.diversity.py	2011-01-18 12:19:39 UTC (rev 45077)
@@ -63,7 +63,7 @@
     # set the home path
     home=os.path.expanduser('~')
     # set the name of conf file
-    confilename = homePath+'/.r.li/history/conf_diversity'
+    confilename = home+'/.r.li/history/conf_diversity'
     # check if GISBASE is set
     if "GISBASE" not in os.environ:
 	# return an error advice
@@ -94,19 +94,19 @@
 	# check if ~/.r.li/history path exists
 	if os.path.exists(home+'/.r.li/history'):
 	    # create configuration file
-	    createConfFile(res,map_in,home)
+	    createConfFile(res,map_in,confilename)
 	else:
 	    # create ~/.r.li/history path
 	    os.path.mkdir(home+'/.r.li/history')
 	    # create configuration file
-	    createConfFile(res,map_in,home)
+	    createConfFile(res,map_in,confilename)
     else:
 	# create ~/.r.li
 	os.path.mkdir(home+'/.r.li/')
 	# create ~/.r.li/history
 	os.path.mkdir(home+'/.r.li/history')
 	# create configuration file
-	createConfFile(res,map_in,home)
+	createConfFile(res,map_in,confilename)
 
 
     ### calculate r.li indices
@@ -123,7 +123,7 @@
     print 'All works are terminated'
 
 #create configuration file instead using r.li.setup
-def createConfFile(res,inpumap,homePath):
+def createConfFile(res,inpumap,filename):
     # start the text for the conf file
     outputLine = ['SAMPLINGFRAME 0|0|1|1\n']
     # return r.info about input file
@@ -140,7 +140,7 @@
     outputLine.append('SAMPLEAREA -1|-1|'+str(rV)+'|'+str(cV)+'\n')
     outputLine.append('MOVINGWINDOW\n')
     # open configuration file
-    fileConf=open(confilename,'w')
+    fileConf=open(filename,'w')
     # write file 
     fileConf.writelines(outputLine)
     # close file



More information about the grass-commit mailing list