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


Python LogStream.logUse方法代码示例

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


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

示例1: makeHazardGrid

# 需要导入模块: import LogStream [as 别名]
# 或者: from LogStream import logUse [as 别名]

#.........这里部分代码省略.........
            mask = self.encodeEditArea(editArea)
        else:
            # make the mask based on the list selections
            if not usingHazLocalEffect:
                mask = self._hazUtils._makeMask(areaList)
            else:
                mask = self._makeMask(areaList, hazLocalEffect)
                
        if usingHazLocalEffect:
            # get the segment number and filter for valid characters
            segNum = segmentNumber
            
            # get the hazards currently defined as temporary grids
            hazParms = self.getHazardParmNames()
            
            # look through the list of grids and create a list of
            # segment numbers (if any) that are already in use
            # for the current hazard
#            if len(hazParms) == 0:
#                self.statusBarMsg("No temporary grids to merge.", "S")
#                return 0
            segList = []
            print "selectedHazard=", selectedHazard
            selectedPhen = selectedHazard[0:2]
            selectedSig  = selectedHazard[3]
            print "selectedPhen,selectedSig=", selectedPhen, ".", selectedSig
            for hazParm in hazParms:
                print "hazParm=", hazParm
                trList = self._hazUtils._getWEInventory(hazParm)
                for tr in trList:
                    print "  tr=", tr, timeRange
                    intersect_hours = tr.intersection(timeRange).duration()
                    print "  intersect=", intersect_hours
                    intersect_percent = intersect_hours / timeRange.duration() * 100.0
                    print "  intersect %=", intersect_percent
                phen = hazParm[3:5]
                sig = hazParm[5:6]
                print "phen,sig=", phen, ".", sig
                if len(hazParm) > 6:
                    if hazParm[6:].isdigit():
                        seg = int(hazParm[6:])
                        print "  seg=", seg
                        if phen == selectedPhen and sig == selectedSig:
                            segList.append(seg)
                            print "appending ", seg
                    else:
                        seg = 0
            segList.sort()

#            print "looping through segList"
#            for seg in segList:
#                print "   seg=", seg," elev=", elevation
#                if str(elevation) == str(seg):
#                    print "adding 1 to elevation"
#                    elevation += 1 
#
#            if elevation > 400:
#                print "using elevation for segNum"
#                segNum = elevation
#                #  replace the segmentNumber field with the elevation +/- the Above/Below indicator.
#                self.__dlg.setSegmentNumber(elevation)
#                segmentNumber = str(elevation)
#                print "*** segmentNumber=", segmentNumber
            
        index = string.find(selectedHazard, " ")
        if index != -1:
            selectedHazard = selectedHazard[0:index]
        if len(segmentNumber) > 0:
            hazardKey = selectedHazard + ":" + segmentNumber
        else:
            hazardKey = selectedHazard
            
        defaultHazKey = ""
        if defaultHazard is not None:
            index = string.find(defaultHazard, " ")
            if index != -1:
                defaultHazard = defaultHazard[0:index]
            defaultHazKey = defaultHazard
            
            if len(defaultSegment) > 0:
                defaultHazKey += ":" + defaultSegment

        weName = self._hazUtils._makeTempWEName(hazardKey)        

        # if we're modifying, remove the old grid first
        if defaultAreaList != [] and hazardKey == defaultHazKey:
            self.deleteCmd([weName], self.selectedTimeRange)

        # if we have no selection prevent user from making an empty hazard
        if 1 not in mask:
            self.statusBarMsg("NO EDIT AREA SELECTED:  \n Select area from map or load edit area in GFE!", "S")
            return 0

        self._hazUtils._addHazard(weName, timeRange, hazardKey, mask)
        LogStream.logUse("Set: ", weName, 
          self._hazUtils._printTime(timeRange.startTime().unixTime()), 
          self._hazUtils._printTime(timeRange.endTime().unixTime()), hazardKey, 
          self._hazUtils._printAreas(areaList))

        return 1
开发者ID:KeithLatteri,项目名称:awips2,代码行数:104,代码来源:MakeHazard.py


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