當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。