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