[GRASS-SVN] r65993 - grass-addons/grass7/raster/r.mcda.topsis

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Aug 23 09:18:53 PDT 2015


Author: gianluca
Date: 2015-08-23 09:18:53 -0700 (Sun, 23 Aug 2015)
New Revision: 65993

Modified:
   grass-addons/grass7/raster/r.mcda.topsis/r.mcda.topsis.py
Log:
improve code style

Modified: grass-addons/grass7/raster/r.mcda.topsis/r.mcda.topsis.py
===================================================================
--- grass-addons/grass7/raster/r.mcda.topsis/r.mcda.topsis.py	2015-08-23 16:16:37 UTC (rev 65992)
+++ grass-addons/grass7/raster/r.mcda.topsis/r.mcda.topsis.py	2015-08-23 16:18:53 UTC (rev 65993)
@@ -64,7 +64,8 @@
 		stats=gscript.parse_command("r.univar",map='critPow',flags='g')
 		nameMap="_%s" % criterion.split("@")[1]
 		mapalgebra="%s=(%s/sqrt(%s))*%s" % (nameMap,criterion,stats['sum'],weight)
-		gscript.mapcalc("${nameMap}=(${criterion}/sqrt(${sum}))*${weight}" ,nameMap=nameMap,criterion=criterion,sum=stats['sum'],weight=weight,overwrite='True')
+		gscript.mapcalc("${nameMap}=(${criterion}/sqrt(${sum}))*${weight}", \
+			nameMap=nameMap,criterion=criterion,sum=stats['sum'],weight=weight,overwrite='True')
 		criteria.append(nameMap)
 	return criteria
 
@@ -103,9 +104,6 @@
 	i=0
 	for c,ip in zip(criteria,idelaPointsList):
 		mapname="tmap_%s" % i
-		#mapalgebra1="%s=pow((%s-%s),2)" % (mapname,c,ip)
-		#print mapalgebra1
-		#gscript.mapcalc(mapalgebra1,overwrite='True')
 		gscript.mapcalc("${mapname}=pow((${c}-${ip}),2)",mapname=mapname,c=c,ip=ip,overwrite='True')
 		distance.append(mapname)
 		i=i+1
@@ -130,7 +128,6 @@
 def relativeCloseness(topsismap): #step5
 	gscript.mapcalc("${topsismap}=WorstPointDistance/(WorstPointDistance+IdealPointDistance)",\
 		topsismap=topsismap,overwrite='True')
-	
 
 
 	



More information about the grass-commit mailing list