本文整理汇总了Python中util.CalcTime.getTimeInSecs函数的典型用法代码示例。如果您正苦于以下问题:Python getTimeInSecs函数的具体用法?Python getTimeInSecs怎么用?Python getTimeInSecs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getTimeInSecs函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: readFCDCompleteOLD
def readFCDCompleteOLD(fcdPath):
"""Reads the FCD-File and creates a list of Id's with a belonging List of Data tuples."""
# reset all
global taxis, routes, vlsEdges, taxiIdDict, fcdDict
taxis = []
routes = []
vlsEdges = []
taxiIdDict = {}
fcdDict = {}
vlsEdges = reader.readVLS_Edges()
inputFile = open(fcdPath, 'r')
for line in inputFile:
words = line.split("\t")
# add route
taxiId = getTaxiId(words[4])
if taxiId in taxis:
if words[1] in vlsEdges:
# routes[taxis.index(taxiId)].append(words[1])
fcdDict[taxiId].append(
(getTimeInSecs(words[0]), words[1], words[2]))
else:
taxiIdDict[words[4]] += 1
# if the edge is in the VLS-Area a new route is created
elif words[1] in vlsEdges:
taxis.append(taxiId)
# departTime
# routes.append([(int)(mktime(strptime(words[0],format))-simDate),words[1]])
fcdDict[taxiId] = [(getTimeInSecs(words[0]), words[1], words[2])]
inputFile.close()
return fcdDict
示例2: readFCD
def readFCD():
"""Reads the FCD and creates a list of Taxis and for each a list of routes"""
vlsEdges = reader.readVLS_Edges()
inputFile = open(path.fcd, 'r')
for line in inputFile:
words = line.split("\t")
# add route
taxiId = getTaxiId(words[4])
actTime = getTimeInSecs(words[0])
if taxiId in taxis:
prevTime = routes[taxis.index(taxiId)][-1][0]
# check if time lies not to far away from each other
if words[1] in vlsEdges and (actTime - prevTime) < 180:
routes[taxis.index(taxiId)].append((actTime, words[1]))
# if time diff >3min add a new taxiId and start a new route
elif words[1] in vlsEdges:
taxiIdDict[words[4]] += 1 # create new taxiId
taxis.append(getTaxiId(words[4])) # append new created id
# append new list (list will be filled with edges)
routes.append([(actTime, words[1])])
else:
taxiIdDict[words[4]] += 1
# if the edge is in the VLS-Area a new route is created
elif words[1] in vlsEdges:
taxis.append(taxiId)
# departTime
routes.append([(actTime, words[1])])
inputFile.close()
print len(taxis)
示例3: readRawFCD
def readRawFCD(rawFcdPath, sim=False):
"""Reads the Raw-FCD-File and creates a list of Id's with a belonging List of Data tuples."""
rawDict={}
inputFile=open(rawFcdPath,'r')
inputFile.seek(30)
for line in inputFile:
words= line.split("\t")
if sim: #id's of simulation raw data must be converted
words[0]=getSimTaxiId(words[0])
if words[0] in rawDict:
# Veh_ID time lat lon speed
rawDict[words[0]].append((getTimeInSecs(words[1]), words[3], words[2], words[5][:-1]))
else:
# Veh_ID time lat lon speed
rawDict[words[0]]=[(getTimeInSecs(words[1]),words[3], words[2], words[5][:-1])]
inputFile.close()
return rawDict
示例4: readSimFCDComplete
def readSimFCDComplete(fcdPath):
"""Reads the FCD-File and creates a list of Id's with a belonging List of Data tuples. Uses the given taxiIds."""
#reset all
global taxis, routes, vlsEdges, taxiIdDict, fcdDict
taxis=[]
routes=[]
vlsEdges=[]
taxiIdDict={}
fcdDict={}
inputFile=open(fcdPath,'r')
for line in inputFile:
words= line.split("\t")
#add route
taxiId=getSimTaxiId(words[4])
if taxiId in taxis:
fcdDict[taxiId].append((getTimeInSecs(getNiceTimeLabel(words[0])),words[1],words[2]))
else:
taxis.append(taxiId)
fcdDict[taxiId]=[(getTimeInSecs(getNiceTimeLabel(words[0])),words[1],words[2])]
inputFile.close()
return fcdDict
示例5: readFCDComplete
def readFCDComplete(fcdPath):
"""Reads the FCD and creates a list of Taxis and for each a list of routes"""
# reset all
global taxis, routes, vlsEdges, taxiIdDict, fcdDict
taxis = []
routes = []
vlsEdges = []
taxiIdDict = {}
fcdDict = {}
vlsEdges = reader.readVLS_Edges()
inputFile = open(path.fcd, 'r')
for line in inputFile:
words = line.split("\t")
# add route
taxiId = getTaxiId(words[4])
actTime = getTimeInSecs(words[0])
if taxiId in taxis:
# prevTime=routes[taxis.index(taxiId)][-1][0]
prevTime = fcdDict[taxiId][-1][0]
# check if time lies not to far away from each other
if words[1] in vlsEdges and (actTime - prevTime) < 180:
#routes[taxis.index(taxiId)].append((actTime, words[1]))
fcdDict[taxiId].append((actTime, words[1], words[2]))
# if time diff >3min add a new taxiId and start a new route
elif words[1] in vlsEdges:
taxiIdDict[words[4]] += 1 # create new taxiId
taxis.append(getTaxiId(words[4])) # append new created id
# append new list (list will be filled with edges)
fcdDict[getTaxiId(words[4])] = [(actTime, words[1], words[2])]
else:
taxiIdDict[words[4]] += 1
# if the edge is in the VLS-Area a new route is created
elif words[1] in vlsEdges:
taxis.append(taxiId)
# departTime
# routes.append([(actTime,words[1])])
fcdDict[taxiId] = [(actTime, words[1], words[2])]
inputFile.close()
return fcdDict
示例6: readFCDOLD
def readFCDOLD():
"""Reads the FCD and creates a list of Taxis and for each a list of routes"""
vlsEdges=reader.readVLS_Edges()
inputFile=open(path.fcd,'r')
for line in inputFile:
words= line.split("\t")
#add route
taxiId=getTaxiId(words[4])
if taxiId in taxis:
if words[1] in vlsEdges:
routes[taxis.index(taxiId)].append(words[1])
else:
taxiIdDict[words[4]]+=1
elif words[1] in vlsEdges: #if the edge is in the VLS-Area a new route is created
taxis.append(taxiId)
# departTime
routes.append([getTimeInSecs(words[0]),words[1]])
inputFile.close()
print len(taxis)