• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python CalcTime.getTimeInSecs函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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
开发者ID:RamonHPSilveira,项目名称:urbansim,代码行数:33,代码来源:GenerateTaxiRoutes.py


示例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)
开发者ID:RamonHPSilveira,项目名称:urbansim,代码行数:31,代码来源:GenerateTaxiRoutes.py


示例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
开发者ID:nnaren1902,项目名称:Secure-Vehicle-Platoon,代码行数:18,代码来源:FetchData.py


示例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    
开发者ID:harora,项目名称:ITS,代码行数:22,代码来源:GenerateTaxiRoutes.py


示例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
开发者ID:RamonHPSilveira,项目名称:urbansim,代码行数:42,代码来源:GenerateTaxiRoutes.py


示例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) 
开发者ID:harora,项目名称:ITS,代码行数:21,代码来源:GenerateTaxiRoutes.py



注:本文中的util.CalcTime.getTimeInSecs函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ObsFile.ObsFile类代码示例发布时间:2022-05-26
下一篇:
Python util.Watchdog类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap