sys.exit("Logfile directory does not exist") else: log=path.join(os.getcwd(),"writeTrafficDensity.log") if path.exists(log): os.remove(log) cf=controlFile.controlFile(controlFilePath) template=xrepedbTemplate.xrepedbTemplate(cf.template) template.modifyParam("edb.user:"******"USER :"******"ELEMENT :",cf.element) report(log,"Running roadSide python script for traffic density") report(log,"controlFile: "+controlFilePath) report(log,"Template for xrepedb: "+cf.template) positionData=fileInput.file2list(cf.coordinateFile,"\t") resFilePath=path.join(cf.outputDir,cf.outputTableName) resFile=open(resFilePath,"w") resFile.write("ID;X;Y") resFile.write(";Trafik-arbete [Milj fkm/år];Typ. hast [km/tim];Andel tunga fordon [%]") resFile.write(";Trafik-arbete [Milj fkm/år];Typ. hast [km/tim];Andel tunga fordon [%]") resFile.write(";Trafik-arbete [Milj fkm/år];Typ. hast [km/tim];Andel tunga fordon [%]") resFile.write("-;m;m\n") resFile.write(";;;r=50m;r=50m;r=50m;r=50m;r=250m;r=250m;r=250m;r=250m;r=500m;r=500m;r=500m;r=500m\n") resFile.close()
log=path.join(os.getcwd(),"updateSimairDB.log") else: controlFilePath=path.abspath(sys.argv[1]) logFilePath=path.abspath(sys.argv[2]) if not path.exists(controlFilePath): sys.exit("Controlfile does not exist") if not path.exists(path.dirname(logFilePath)): sys.exit("Logfile directory does not exist") else: log=path.join(os.getcwd(),"updateSimairDB.log") if path.exists(log): os.remove(log) report(log,"\n"+20*"="+"Starting update procedure"+20*"=",reportToPrompt) cf=controlFile.controlFile(controlFilePath) #Collecting parameters from controlFile new_edb=cf.findString("new_edb:") report(log,"new_ed: "+new_edb,reportToPrompt) old_edb=cf.findString("old_edb:") report(log,"old_edb: "+old_edb,reportToPrompt) wd=cf.findExistingPath("workingDir:") report(log,"workingDir: "+wd,reportToPrompt) od=cf.findExistingPath("outputDir:") report(log,"outputDir: "+od,reportToPrompt) parameters=cf.findStringList("parameters:") strParams=""