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


Python HelperFunctions.check_progress方法代码示例

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


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

示例1: output_results

# 需要导入模块: import HelperFunctions [as 别名]
# 或者: from HelperFunctions import check_progress [as 别名]
def output_results():
    """ This function writes results to the output feature class. """
    HF.pGP.AddMessage("--------" + getCurTime() + "--------")
    HF.pGP.AddMessage("Outputting results...")
    outField = "SpCluster"

    # Add results field.
    if not properties.dcFields.has_key(outField.upper()):
        try:
            HF.pGP.AddField(inputs.sOutputFC, outField, "text")
        except:
            HF.pGP.GetMessages(2)
    else:
        outField = "SpCluster_1"
        if not properties.dcFields.has_key(outField.upper()):
            try:
                HF.pGP.AddField(inputs.sOutputFC, outField, "text")
            except:
                HF.pGP.GetMessages(2)

    # Add results to output FC
    HF.pGP.AddMessage(HF.sWritingResults)
    # sFieldList = properties.sFID + ";" + sField + ";" + cField
    pRows = HF.pGP.UpdateCursor(inputs.sOutputFC)
    pRow = pRows.Next()

    # add message of processes
    iError = 0
    iCnt = 0
    fInterval = len(attri) / 5.0
    fMore = fInterval
    iComplete = 20
    iKey = 0

    # test = []

    while pRow <> None:
        iKey = pRow.GetValue("FID")

        # print iKey
        try:
            pRow.SetValue(outField, clusterAttri[iKey, -1])

            pRows.UpdateRow(pRow)
            iCnt = iCnt + 1
            if iCnt > fInterval:
                fInterval, iComplete = HF.check_progress(fInterval, fMore, iComplete)
        # except: pass
        except:
            iError = iError + 1

        pRow = pRows.Next()

    # print "++++++++++++++++++++++"
    # print iError

    HF.pGP.AddMessage(HF.s100Percent)
    HF.pGP.AddMessage(" ")
    pRows = None
开发者ID:huhugravity,项目名称:mypythoncode,代码行数:61,代码来源:SpaptialAdjustment.py

示例2: output_results

# 需要导入模块: import HelperFunctions [as 别名]
# 或者: from HelperFunctions import check_progress [as 别名]
def output_results(mDict,cDict):
    """ This function writes results to the output feature class. """
    sField = "MaxGi"
    cField = "Core"
    # Add results field.
    if not properties.dcFields.has_key(sField.upper()):
        HF.pGP.AddField(inputs.sOutputFC, sField, "FLOAT")
    if not properties.dcFields.has_key(cField.upper()):
        HF.pGP.AddField(inputs.sOutputFC, cField, "TEXT")

    # Add results to output FC
    HF.pGP.AddMessage (HF.sWritingResults)
    sFieldList = properties.sFID + ";" + sField + ";" + cField
    pRows = HF.pGP.UpdateCursor(inputs.sOutputFC,"","",sFieldList)
    #pRows = pGP.UpdateCursor(inputs.sOutputFC)
    pRow = pRows.Next()
    iCnt = 0
    fInterval = len(keys) / 5.0
    fMore = fInterval
    iComplete = 20
    while pRow <> None:
        iKey = pRow.GetValue(properties.sFID)
        try:
            if mDict [iKey]:  # make sure we have a non-Null result.
                pRow.SetValue(sField, mDict[iKey])
                pRows.UpdateRow(pRow)
            iCnt = iCnt + 1
            if iCnt > fInterval: fInterval, iComplete = HF.check_progress(fInterval, fMore, iComplete)
        except: pass
        try:
            if cDict [iKey]:  # make sure we have a non-Null result.
                pRow.SetValue(cField, cDict[iKey])
                pRows.UpdateRow(pRow)
        except:
            pRow.SetValue(cField, "Outside Clusters")
            pRows.UpdateRow(pRow)
        pRow = pRows.Next()
    HF.pGP.AddMessage (HF.s100Percent)
    HF.pGP.AddMessage(" ")
    pRows = None           
    return sField    
开发者ID:huhugravity,项目名称:mypythoncode,代码行数:43,代码来源:AMOEBAClustering.py

示例3: output_results

# 需要导入模块: import HelperFunctions [as 别名]
# 或者: from HelperFunctions import check_progress [as 别名]
def output_results(Cluster):
    """ This function writes results to the output feature class. """
    
    # Add results field.
    HF.pGP.AddMessage ("--------" + getCurTime() + "--------")
    HF.pGP.AddMessage ("Adding results fields...")
    addField = []
    
    for Field in inputs.sZField:
        if len(Field) > 8:
            Field = Field[0:8]
        #Field = Field + "_N"
        addField.append(Field + "_N")

    if inputs.sXY == "Yes":
        addField.append("X_cent_N")
        addField.append("Y_cent_N")
    
    for Field in addField:
        if not properties.dcFields.has_key(Field.upper()):
            HF.pGP.AddField(inputs.sOutputFC, Field, "FLOAT")

    outField = "CLUSTER"    
    if not properties.dcFields.has_key(outField.upper()):
        HF.pGP.AddField(inputs.sOutputFC, outField, "LONG")
    else:
        outField = "CLUSTER_1"
        if not properties.dcFields.has_key(outField.upper()):
            HF.pGP.AddField(inputs.sOutputFC, outField, "LONG")
        
    #addField.append("CLUSTER") 

    # Add results to output FC
    HF.pGP.AddMessage ("--------" + getCurTime() + "--------")
    HF.pGP.AddMessage (HF.sWritingResults)
    pRows = HF.pGP.UpdateCursor(inputs.sOutputFC)
    pRow = pRows.Next()
    iError = 0
    iCnt = 0
    fInterval = len(attri) / 5.0
    fMore = fInterval
    iComplete = 20
    
    while pRow <> None:
        iKey = pRow.GetValue("FID")

        #print iKey
        try:
            if Cluster[iKey]:  # make sure we have a non-Null result.
                #since the type of Cluster[iKey] is numpy.int32, it should convert to [int]
                for Field in addField:
                    iIndex = addField.index(Field)
                    temp = float(clusterAttri_Norm[iKey, iIndex])
                    pRow.SetValue(Field, temp)

            temp = int(Cluster[iKey])
            pRow.SetValue(outField, temp)
                    
            pRows.UpdateRow(pRow)
            iCnt = iCnt + 1
            if iCnt > fInterval: fInterval, iComplete = HF.check_progress(fInterval, fMore, iComplete)
        #except: pass
        except:
            iError = iError + 1
        
        pRow = pRows.Next()
        

    #print "++++++++++++++++++++++"
    print iError
    
        
    HF.pGP.AddMessage (HF.s100Percent)
    HF.pGP.AddMessage(" ")
    pRows = None           
开发者ID:huhugravity,项目名称:mypythoncode,代码行数:77,代码来源:AttriClustering.py

示例4: abs

# 需要导入模块: import HelperFunctions [as 别名]
# 或者: from HelperFunctions import check_progress [as 别名]
            
        if aStat > 0:
            clusterHighList.append([aList,aStat])
        else:
            clusterLowList.append([aList,aStat])
            
        for j in aList:
            if maxDict.has_key(j):
                if abs(aStat) > abs(maxDict[j]):
                    maxDict[j] = aStat
            else:
                maxDict[j] = aStat
                
        iCnt += 1
        if iCnt > fInterval:
            fInterval, iComplete = HF.check_progress(fInterval, fMore, iComplete)

    if method=="2":
        HF.pGP.AddWarning("Finding FDR...")
        data={}
        data=maxDict.copy()
        for j in range(0,iNumRecs):
            #print data[j],
            data[j]=[pValForGi(data[j]),data[j]] 
            #print data[j][0]
        alpha=float(inputs.confidenceLevel)
        for j in range(0,iNumRecs-1):
            for i in range(0,iNumRecs-1):
                if data[i][0] < data[i+1][0]:
                    tem=data[i]
                    data[i]=data[i+1]
开发者ID:huhugravity,项目名称:mypythoncode,代码行数:33,代码来源:AMOEBAClustering.py

示例5: output_results

# 需要导入模块: import HelperFunctions [as 别名]
# 或者: from HelperFunctions import check_progress [as 别名]
def output_results(deviation):
    """ This function writes results to the output feature class. """
    HF.pGP.AddMessage ("--------" + getCurTime() + "--------")
    HF.pGP.AddMessage ("Outputting results...")
    outField = "Outlier"
    
    # Add results field.
    if not properties.dcFields.has_key(outField.upper()):
        try:
            HF.pGP.AddField(inputs.sOutputFC, outField, "TEXT")
        except:
            HF.pGP.GetMessages(2)
    else:
        outField = "Outlier_1"
        if not properties.dcFields.has_key(outField.upper()):
            try:
                HF.pGP.AddField(inputs.sOutputFC, outField, "TEXT")
            except:
                HF.pGP.GetMessages(2)

    addField = []
    
    for Field in inputs.sZField:
        if len(Field) > 8:
            Field = Field[0:8]
        #Field = Field + "_N"
        addField.append(Field + "_O")

    for Field in addField:
        if not properties.dcFields.has_key(Field.upper()):
            HF.pGP.AddField(inputs.sOutputFC, Field, "TEXT")        
                
    # Add results to output FC
    HF.pGP.AddMessage (HF.sWritingResults)
    #sFieldList = properties.sFID + ";" + sField + ";" + cField
    pRows = HF.pGP.UpdateCursor(inputs.sOutputFC)
    pRow = pRows.Next()

    # add message of processes 
    iError = 0
    iCnt = 0
    fInterval = len(attri) / 5.0
    fMore = fInterval
    iComplete = 20
    iKey = 0

    #test = []    
    
    while pRow <> None:
        #iKey = pRow.GetValue("FID")
        
        #print iKey
        try:
            if deviation[iKey] > fRange:  # make sure we have a non-Null result.
                pRow.SetValue(outField, "Y")
                for Field in addField:
                    iIndex = addField.index(Field)
                    #print iIndex
                    #print clusterAttri[iKey,0:-1], average[iIndex,0:-1]
                    #test.append(calculate_single_deviation(clusterAttri[iKey,0:-1], average, iIndex))
                    if calculate_single_deviation(clusterAttri[iKey,:], average, iIndex):
                        pRow.SetValue(Field, "Y")
                    else:
                        pRow.SetValue(Field, "N")
                        #pRow.SetValue(Field, temp)
            else:
                pRow.SetValue(outField, "N")
                for Field in addField:
                    pRow.SetValue(Field, "N")
            pRows.UpdateRow(pRow)
            iCnt = iCnt + 1
            if iCnt > fInterval: fInterval, iComplete = HF.check_progress(fInterval, fMore, iComplete)
            #pRow = pRows.Next()
            
        #except: pass
        except:
            iError = iError + 1
        
        pRow = pRows.Next()
        iKey = iKey + 1
        

    #print "++++++++++++++++++++++"
    #print iError

    HF.pGP.AddMessage (HF.s100Percent)
    HF.pGP.AddMessage(" ")
    pRows = None
开发者ID:huhugravity,项目名称:mypythoncode,代码行数:90,代码来源:OutlierAnalysis.py


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