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


Python Avn.time2string方法代码示例

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


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

示例1: getXmitTime

# 需要导入模块: import Avn [as 别名]
# 或者: from Avn import time2string [as 别名]
def getXmitTime(kind, headertime):
    t = Avn.string2time('%s%s' % (Avn.time2string()[:6], headertime[2:])) \
        + 3600.0 - _Xmit_Windows[0]
    now = time.time()
    if t < now - 43200.0:
        t += 86400.0
    return max(t, now)
开发者ID:KeithLatteri,项目名称:awips2,代码行数:9,代码来源:AvnLib.py

示例2: getEtaTable

# 需要导入模块: import Avn [as 别名]
# 或者: from Avn import time2string [as 别名]
 def getEtaTable(self, ids, issuetime=None):
     # Returns most recent tabulated ETA model data
     if type(ids) == type(''):
         idslist = [ids]
     else:
         idslist = ids
     tables = []
     for i in idslist:
         path = os.path.join('data', 'eta', i)
         try:
             if issuetime:
                 f = Avn.time2string(issuetime) + '.table'
             else:
                 f = _getFiles(path, 16, time.time()-86400.0, 1)[0]
             tables.append(Avn.Bunch(file=f, 
                 table=file(os.path.join(path, f)).read()))
         except (IndexError, OSError):
             pass
     if type(ids) == type(''):
         try:
             return tables[0]
         except IndexError:
             return None
     else:
         return tables
开发者ID:KeithLatteri,项目名称:awips2,代码行数:27,代码来源:DataRequestServ.py

示例3: getEtaData

# 需要导入模块: import Avn [as 别名]
# 或者: from Avn import time2string [as 别名]
 def getEtaData(self, ids, issuetime=None):
     # Returns most recent Eta model data
     if type(ids) == type(''):
         idslist = [ids]
     else:
         idslist = ids
     data = []
     for i in idslist:
         path = os.path.join('data', 'eta', i)
         try:
             if issuetime:
                 f = Avn.time2string(issuetime) + '.data'
             else:
                 f = _getFiles(path, 15, time.time()-86400.0, 1)[0]
             data.append(Avn.Bunch(file=f, 
                 data=cPickle.load(file(os.path.join(path, f)))))
         except (IndexError, OSError):
             pass
     if type(ids) == type(''):
         try:
             return data[0]
         except IndexError:
             return None
     else:
         return data
开发者ID:KeithLatteri,项目名称:awips2,代码行数:27,代码来源:DataRequestServ.py

示例4: __make_stats

# 需要导入模块: import Avn [as 别名]
# 或者: from Avn import time2string [as 别名]
    def __make_stats(self):
        now = time.time()
        ftime = self.__get_timestamp()
        if now - ftime < 3600.0*self._cfg['period']:
            return
        def _process_forecast(f):
            ftok = f.split('-')
            yymm = ftok[4][:4]
            text = file(os.path.join('xmit', 'sent', f)).read()
            if not text.startswith('TAF'):
                return None
            text = text[text.find('\n')+1:]
            tafs = filter(None, [x.strip() for x in self.regSplit.split(text)])
            def _makeLine(taf):
                ttok = taf.split()
                return ' '.join(ftok[2:6] + \
                    [ttok[0], yymm+ttok[1], ttok[2], ftok[0]])
            return '\n'.join(map(_makeLine, tafs))
	try:
            report = '\n'.join(map(_process_forecast, self.__get_files(ftime)))
            if not report:
                raise Avn.AvnError, 'No data to process'
            report += '\n'
            tt, cc = self._cfg['wmo'].split()
            path = os.path.join('xmit', 'pending', '%03d-%s-%s-%s-%s-%s-%-10d' \
                % (self._cfg['fcstid'], self._cfg['awips'], tt, cc, \
                Avn.time2string(now), '___', now))
            file(path, 'w').write(report)
            self.__update_timestamp()
        except Avn.AvnError, e:
            _Logger.warning(str(e))
            self.__update_timestamp()
开发者ID:KeithLatteri,项目名称:awips2,代码行数:34,代码来源:XmitServ.py

示例5: _cleanup

# 需要导入模块: import Avn [as 别名]
# 或者: from Avn import time2string [as 别名]
def _cleanup(path, nhours):
    tstamp = Avn.time2string(time.time()-nhours*3600.0)
    for f in os.listdir(path):
        if f[:10] < tstamp:
            fname = os.path.join(path, f)
            try:
                os.unlink(fname)
            except OSError, e:
                _Logger.exception('Cannot remove %s', fname)
开发者ID:KeithLatteri,项目名称:awips2,代码行数:11,代码来源:MosData.py

示例6: _makeTimeStamp

# 需要导入模块: import Avn [as 别名]
# 或者: from Avn import time2string [as 别名]
def _makeTimeStamp(tstamp):
    # Returns time stamp used in output file name
    now = time.time()
    tmptstamp = '%s%s' % (Avn.time2string(now)[:4], tstamp)
    # possible correction for next month/year
    t = Avn.string2time(tmptstamp)
    if t > now + 86400:
        mm = int(tmptstamp[2:4]) - 1
        yy = int(tmptstamp[:2])
        if mm < 1:
            mm = 12
            yy -= 1
        return '%02d%02d%s' % (yy, mm, tmptstamp[4:])
    else:
        return tmptstamp
开发者ID:KeithLatteri,项目名称:awips2,代码行数:17,代码来源:DataRequestServ.py

示例7: retrieve

# 需要导入模块: import Avn [as 别名]
# 或者: from Avn import time2string [as 别名]
def retrieve(model, idlist, retrieveReport, refTime=None):
    nc = _NetCDFFile()
    ids = []
    for ident in idlist:
        try:
#            print 'EtaData.retrieve ident(%s), retrieveReport(%s), refTime(%s)' % (ident, retrieveReport, refTime)
            table = None
            data = nc.makeData(ident, refTime=refTime)
            tstamp = Avn.time2string(data['itime']['value'])
            if retrieveReport:
                table = nc.makeTable(data) # table view
            ids.append(Avn.Bunch(data=data, rpt=table))
            _Logger.info('Retrieved data for %s', ident)
        except Avn.AvnError, e:
            _Logger.error(str(e))
        except NoDataException.NoDataException, e:
            msg = [str(e)]
            ids.append(Avn.Bunch(data=msg, rpt=msg))
开发者ID:KeithLatteri,项目名称:awips2,代码行数:20,代码来源:EtaData.py

示例8: __update_timestamp

# 需要导入模块: import Avn [as 别名]
# 或者: from Avn import time2string [as 别名]
 def __update_timestamp(self):
     try:
         file(self.TimeStamp, 'w').write(Avn.time2string())
     except:
         _Logger.exception('Cannot update %s', self.TimeStamp)
         raise SystemExit
开发者ID:KeithLatteri,项目名称:awips2,代码行数:8,代码来源:XmitServ.py


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