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


Python LogStream.logDiag方法代码示例

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


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

示例1: createAreaDictionary

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logDiag [as 别名]
def createAreaDictionary(outputDir, mapDict):
    LogStream.logEvent("Generating AreaDictionary")
    areadict = {}
    mapIter = mapDict.entrySet().iterator()
    while mapIter.hasNext():
        entry = mapIter.next() 
        ean = str(entry.getKey())
        att = entry.getValue()
        if len(ean):
            try:
                d = {}
                if att.containsKey('zone') and att.containsKey('state'):
                    d['ugcCode'] = str(att.get('state')) + "Z" + str(att.get('zone'))
                elif att.containsKey('id'):
                    d['ugcCode'] = str(att.get('id'))
                elif att.containsKey('fips') and att.containsKey('state') and \
                  att.containsKey('countyname'):
                    d['ugcCode'] = str(att.get('state')) + "C" + str(att.get('fips'))[-3:]
                    d['ugcName'] = string.strip(str(att.get('countyname')))
                else:
                    continue

                if att.containsKey('state'):
                    d["stateAbbr"] = str(att.get('state'))

                if att.containsKey('name'):
                    d["ugcName"] = string.strip(str(att.get('name')))

                if att.containsKey('time_zone'):
                    tzvalue = getRealTimeZone(str(att.get('time_zone')))
                    if tzvalue is not None:
                        d["ugcTimeZone"] = tzvalue

                if zonedata.has_key(d['ugcCode']):
                    cityDict = zonedata[d['ugcCode']]
                elif fipsdata.has_key(d['ugcCode']):
                    cityDict = fipsdata[d['ugcCode']]
                else:
                    cityDict = None

                if cityDict:
                    cityString = makeCityString(cityDict)
                    if cityString is not None:
                        cityString, locs = cityString
                        if len(cityString): 
                            d["ugcCityString"] = cityString
                            CityLocationDict[ean] = locs

                # partOfState codes
                if zonedata.has_key(d['ugcCode']):
                    if zonedata[d['ugcCode']].has_key('partOfState'):
                        d["partOfState"] = \
                          zonedata[d['ugcCode']]['partOfState']
                elif fipsdata.has_key(d['ugcCode']):
                    if fipsdata[d['ugcCode']].has_key('partOfState'):
                        d["partOfState"] = \
                          fipsdata[d['ugcCode']]['partOfState']
                      
                # full state name
                if zonedata.has_key(d['ugcCode']):
                    if zonedata[d['ugcCode']].has_key('fullStateName'):
                        d["fullStateName"] = \
                          zonedata[d['ugcCode']]['fullStateName']
                elif fipsdata.has_key(d['ugcCode']):
                    if fipsdata[d['ugcCode']].has_key('fullStateName'):
                        d["fullStateName"] = \
                          fipsdata[d['ugcCode']]['fullStateName']
                else: 
                    marineState = checkMarineState(d['ugcCode'])
                    if marineState is not None:
                        d['fullStateName'] = marineState
                
                      
                if areadict.has_key(ean) and d != areadict[ean]:
                    LogStream.logDiag("Mismatch of definitions in " +\
                      "AreaDictionary creation. EditAreaName=",  ean,
                      "AreaDict=\n", areadict[ean], "\nIgnored=\n", d)
                else:
                    areadict[ean] = d
            except:
                LogStream.logProblem("Problem with ", ean, LogStream.exc())

    s = """
# ----------------------------------------------------------------------------
# This software is in the public domain, furnished "as is", without technical
# support, and with no warranty, express or implied, as to its usefulness for
# any purpose.
#
# AreaDictionary
#   AreaDictionary file
#
# Author: GFE Installation Script
# ----------------------------------------------------------------------------

# Format:
# AreaDictionary = {
#    "editArea" : {
#             "ugcCode": "STZxxx",
#             "ugcName": "EditAreaName",
#             "ugcCityString": "...CITY1...CITY2",
#.........这里部分代码省略.........
开发者ID:KeithLatteri,项目名称:awips2,代码行数:103,代码来源:createAreaDictionary.py


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