[GRASS-SVN] r59582 - grass-addons/grass7/vector/v.neighborhoodmatrix

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Apr 5 09:49:39 PDT 2014


Author: mlennert
Date: 2014-04-05 09:49:39 -0700 (Sat, 05 Apr 2014)
New Revision: 59582

Modified:
   grass-addons/grass7/vector/v.neighborhoodmatrix/v.neighborhoodmatrix.py
Log:
added some comments to make code more understandable


Modified: grass-addons/grass7/vector/v.neighborhoodmatrix/v.neighborhoodmatrix.py
===================================================================
--- grass-addons/grass7/vector/v.neighborhoodmatrix/v.neighborhoodmatrix.py	2014-04-05 16:43:49 UTC (rev 59581)
+++ grass-addons/grass7/vector/v.neighborhoodmatrix/v.neighborhoodmatrix.py	2014-04-05 16:49:39 UTC (rev 59582)
@@ -58,11 +58,13 @@
             type='boundary', option='sides', layer=blayer, qlayer=player, quiet=True)
     grass.run_command('g.remove', vect=tempmapname, quiet=True)
 
+    #put result into a list of integer pairs
     temp_neighbors=[]
     for line in vtodb_results.splitlines():
         if line.split('|')[1]<>'-1' and line.split('|')[2]<>'-1':
                 temp_neighbors.append([int(line.split('|')[1]), int(line.split('|')[2])])
 
+    #uniqify the list of integer pairs
     n = len(temp_neighbors)
     t=list(temp_neighbors)
     t.sort()
@@ -76,6 +78,7 @@
         i += 1
     neighbors=t[:lasti]
 
+    #if user wants bidirectional matrix, add the inversed pairs to the original
     if bidirectional:
         neighbors_reversed=[]
         for pair in neighbors:



More information about the grass-commit mailing list