当前位置: 首页>>代码示例>>Python>>正文


Python Avn.mkgmtime方法代码示例

本文整理汇总了Python中Avn.mkgmtime方法的典型用法代码示例。如果您正苦于以下问题:Python Avn.mkgmtime方法的具体用法?Python Avn.mkgmtime怎么用?Python Avn.mkgmtime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Avn的用法示例。


在下文中一共展示了Avn.mkgmtime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: getFmtValidTime

# 需要导入模块: import Avn [as 别名]
# 或者: from Avn import mkgmtime [as 别名]
def getFmtValidTime(kind, bbb, t=None, tafDuration=24, evtime=None):
    # Returns valid time as yymmddHHhh for 'bbb'
    if t is None:
        t = time.time()
    #
    # Get the ending day and hour first
    tms = list(time.gmtime(t))
    tms[3:6] = _startHour(bbb, t), 0, 0
    if tms[3] == 0:
        try:
            if bbb[0] == ' ':
                tms[2] += 1
        except IndexError:
            tms[2] += 1

    tms = list(time.gmtime(Avn.mkgmtime(tms) + tafDuration*3600))
    endday,endhour = tms[2:4]
    if tms[3] == 0:
        tms[3] = -1
        endday,endhour = time.gmtime(Avn.mkgmtime(tms))[2],24
    #
    # for amendments and delayed forecasts: use closest hour
    if bbb and bbb[0] != ' ':
        starthour = int(((t+1800.0)//3600))%24
        #
        # If amendment needed before valid period starts (up to 40 minutes
        # prior (2400s)), preserve previous ending valid time
        #
        if evtime and (_Fcst_Times[0] - t%_Fcst_Times[0]) < 2400:
            endday,endhour = int(evtime[:2]),int(evtime[2:])
    #
    # Otherwise, find the next regular issuance time
    else:
        starthour = _startHour(bbb,t)
        
    tms = list(time.gmtime(t))
    if starthour < tms[3]:
        t += 86400.0
        tms = list(time.gmtime(t))

    tms[3:6] = starthour, 0, 0
    year, month, startday = tms[:3]
    
    return '%02d%02d%02d%02d/%02d%02d' % (year-2000, month, startday, starthour, endday, endhour)
开发者ID:KeithLatteri,项目名称:awips2,代码行数:46,代码来源:AvnLib.py

示例2: _filterPeriods

# 需要导入模块: import Avn [as 别名]
# 或者: from Avn import mkgmtime [as 别名]
def _filterPeriods(bbb, periods, t, kind, tafDuration):
    starttime = getValidTime(kind, bbb, t)
    tms = list(time.gmtime(starttime))
    tms[3] = _startHour(bbb, t)
    endtime = Avn.mkgmtime(tms)
    if endtime <= starttime:
        endtime += tafDuration*3600.0
    def _within(p):
        return p['prev']['time']['to'] > starttime and \
            p['prev']['time']['from'] < endtime
    return itertools.ifilter(_within, periods)
开发者ID:KeithLatteri,项目名称:awips2,代码行数:13,代码来源:AvnLib.py

示例3: getValidTime

# 需要导入模块: import Avn [as 别名]
# 或者: from Avn import mkgmtime [as 别名]
def getValidTime(kind, bbb, t=None):
    # returns start of valid time
    if t is None:
        t = time.time()
    starthour = _startHour(bbb, t)
    if bbb and bbb[0] != ' ':
       # amendments and delayed forecasts: use closest hour
       starthour = int(((t+1800.0)//3600))%24
    if starthour < time.gmtime(t)[3]:
        t += 86400.0
           
    tms = list(time.gmtime(t))
    tms[3:6] = starthour, 0, 0
    return Avn.mkgmtime(tms)
开发者ID:KeithLatteri,项目名称:awips2,代码行数:16,代码来源:AvnLib.py


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