changeset 966:40af0f20ee2d

reworking the functions
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 05 Dec 2017 16:11:49 -0500
parents eec549e9ff2e
children 373e8ef6ee25
files python/sumo.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/python/sumo.py	Tue Dec 05 11:52:59 2017 -0500
+++ b/python/sumo.py	Tue Dec 05 16:11:49 2017 -0500
@@ -5,7 +5,7 @@
 
 import csv
 
-def convertTazEdges(inFilename, outFilename):
+def loadTazEdges(inFilename):
     '''Converts list of OSM edges per OSM edge and groups per TAZ'''
     data = []
     tazs = {}
@@ -26,13 +26,15 @@
                                 tazs[tazID].append(edge)
                         else:
                             tazs[tazID] = [edge]
-
+    return tazs
+        
+def saveTazEdges(outFilename, tazs):
     with open(outFilename,'w') as out:
 	out.write('<tazs>\n')				
 	for tazID in tazs:
 	    out.write('<taz id="{}" edges="'.format(tazID)+' '.join(tazs[tazID])+'"/>\n')
 	out.write('</tazs>\n')
-
+    
 # TODO add utils from process-cyber.py?
         
 # if __name__ == "__main__":