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


Python SSUtilities.formatValue方法代码示例

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


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

示例1: createCoefficientReport

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import formatValue [as 别名]
    def createCoefficientReport(self):
        """Creates a formatted summary table of the OLS
        coefficients."""

        #### Table Title ####
        header =  ARCPY.GetIDMessage(84075)
        aFoot = ARCPY.GetIDMessage(84080)
        bFoot = ARCPY.GetIDMessage(84086)
        cFoot = ARCPY.GetIDMessage(84103)
        coefColLab = ARCPY.GetIDMessage(84049) + " " + aFoot
        probColLab = ARCPY.GetIDMessage(84055) + " " + bFoot
        robColLab = ARCPY.GetIDMessage(84102) + " " + bFoot
        vifColLab = ARCPY.GetIDMessage(84284) + " " + cFoot

        #### Column Labels ####
        total = [[ARCPY.GetIDMessage(84068), coefColLab,
                  ARCPY.GetIDMessage(84051), ARCPY.GetIDMessage(84053),
                  probColLab, ARCPY.GetIDMessage(84097),
                  ARCPY.GetIDMessage(84101), robColLab]]

        if self.vif:
            total[0].append(vifColLab)

        #### Loop Through Explanatory Variables ####
        for row in xrange(self.k):
            #### Variable Name ####
            rowVals = [self.varLabels[row]]

            #### Standard Values ####
            rowVals.append(UTILS.formatValue(self.coef[row, 0]))
            rowVals.append(UTILS.formatValue(self.seCoef[row]))
            rowVals.append(UTILS.formatValue(self.tStats[row]))
            rowVals.append(UTILS.writePVal(self.pVals[row], padNonSig = True))

            #### Robust Values ####
            rowVals.append(UTILS.formatValue(self.seCoefRob[row]))
            rowVals.append(UTILS.formatValue(self.tStatsRob[row]))
            rowVals.append(UTILS.writePVal(self.pValsRob[row],
                                           padNonSig = True))

            #### VIF ####
            if self.vif:
                if row == 0:
                    rowVIF = ARCPY.GetIDMessage(84092)
                else:
                    rowVIF = self.vifVal[(row - 1)]
                    if abs(rowVIF) > 1000:
                        rowVIF = "> 1000.0"
                    else:
                        rowVIF = LOCALE.format("%0.6f", rowVIF)
                rowVals.append(rowVIF)

            #### Append Row to Result List ####
            total.append(rowVals)

        #### Finalize Coefficient Table ####
        self.coefTable = UTILS.outputTextTable(total, header = header,
                                               pad = 1, justify = "right")
        self.coefRaw = total
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:61,代码来源:OLS.py

示例2: report

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import formatValue [as 别名]
    def report(self, orderType = 0, formatStr = "%0.6f", addModel = True):
        """Reports the results of the OLS run.

        INPUTS:
        orderType {int, 0}: Sort by - 0:R2, 1:Jarque-Bera, 2:Moran
        formatStr (str): format string, E.g. "%0.6f"
        addModel {bool, True}: Add model to report?
        """

        #### Set Output Moran's I p-value ####
        if self.allMIPass:
            #### Make p-value NA ####
            miVal = ARCPY.GetIDMessage(84499)
        else:
            if self.miPVal is None:
                miVal = ""
            else:
                miVal = self.miPVal

        vifInd = -2
        if orderType == 0:
            resultList = [ self.r2, self.aic, self.jb, self.bp,
                           self.maxVIFValue, miVal ]
        elif orderType == 1:
            resultList = [ self.jb, self.r2, self.aic, self.bp,
                           self.maxVIFValue, miVal ]
        else:
            resultList = [ miVal, self.r2, self.aic, self.jb, self.bp,
                           self.maxVIFValue ]
            vifInd = -1

        resultListVals = []
        for val in resultList:
            try:
                outValue = UTILS.formatValue(val, formatStr)
            except:
                outValue = val
            resultListVals.append(outValue)

        if self.maxVIFValue >= 1000:
            resultListVals[vifInd] = ">" + LOCALE.format("%0.2f", 1000.)
        if addModel:
            resultListVals.append(self.model)

        return resultListVals
开发者ID:f-tonini,项目名称:Python-Scripts,代码行数:47,代码来源:ModelSelectionOLS.py

示例3: createOutputGraphic

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

#.........这里部分代码省略.........
                            LOCALE.format("%0.6f", ei),
                            justify = "right")
            grid.writeCell((grid.rowCount, 3),
                            LOCALE.format("%0.6f", vi),
                            justify = "right")
            grid.writeCell((grid.rowCount, 4),
                            LOCALE.format("%0.6f", zi),
                            justify = "right")
            grid.writeCell((grid.rowCount, 5),
                            LOCALE.format("%0.6f", pv),
                            justify = "right")
            grid.stepRow()

        if grid.rowCount <= 19:
            grid.createLineRow(grid.rowCount, startCol = 0, endCol = 7)
            grid.stepRow()

        #### Add Footnotes, Peaks, Linear Unit, No Neighbor Message ####
        footNotes = []

        #### Report Peaks ####
        firstPeakMess = ARCPY.GetIDMessage(84419)
        decimalSep = UTILS.returnDecimalChar()
        if decimalSep == ".":
            numSep = ","
        else:
            numSep = ";"
        if self.firstPeakInd != None:
            zi = LOCALE.format("%0.6f", self.giResults[self.firstPeakInd,4])
            d = LOCALE.format("%0.2f", round(self.firstPeakDistance, 2))
            firstPeakMess = firstPeakMess.format(d, numSep, zi)
        else:
            firstPeakMess = firstPeakMess.format("None",numSep, "None")
        footNotes += REPORT.splitFootnote(firstPeakMess, 145)

        maxPeakMess = ARCPY.GetIDMessage(84420)
        if self.maxPeakInd != None:
            zi = LOCALE.format("%0.6f", self.giResults[self.maxPeakInd,4])
            d = LOCALE.format("%0.2f", round(self.maxPeakDistance, 2))
            maxPeakMess = maxPeakMess.format(d, numSep, zi)
        else:
            maxPeakMess = maxPeakMess.format("None",numSep, "None")
        footNotes += REPORT.splitFootnote(maxPeakMess, 145)

        #### Add Linear/Angular Unit ####
        distanceOut = self.ssdo.distanceInfo.outputString
        dmsg = ARCPY.GetIDMessage(84344)
        distanceMeasuredStr = dmsg.format(distanceOut)
        footNotes += REPORT.splitFootnote(distanceMeasuredStr, 145)

        #### Add No Neighbor Message ####
        if hasNoNeighs:
            noNeighMess = ARCPY.GetIDMessage(84417)
            footNotes += REPORT.splitFootnote(noNeighMess, 145)

        for line in footNotes:
            if grid.rowCount >= 19:
                #### Finalize Page ####
                grid.finalizeTable()
                report.write(pdfOutput)

                #### New Page ####
                report = REPORT.startNewReport(7, title = titlePlus,
                                                   landscape = True,
                                     titleFont = REPORT.ssTitleFont)

                grid = report.grid

            #### Write Footnote ####
            grid.writeCell((grid.rowCount, 0), line,
                            colspan = 7, justify = "left")
            grid.stepRow()

        grid.finalizeTable()

        #### Add To PDF ####
        report.write(pdfOutput)
        ARCPY.SetProgressorPosition()

        ##### Add Dataset/Parameter Info ####
        paramLabels = [84253, 84016, 84374, 84375, 84376, 84235, 84236, 84418]
        paramLabels = [ ARCPY.GetIDMessage(i) for i in paramLabels ]

        paramValues = [self.ssdo.inputFC, self.varName,
                       "%i" % self.nIncrements,
                       UTILS.formatValue(self.begDist),
                       UTILS.formatValue(self.dIncrement),
                       self.concept, "%s" % self.rowStandard,
                       str(self.ssdo.selectionSet)]

        title = ARCPY.GetIDMessage(84373)
        REPORT.createParameterPage(paramLabels, paramValues,
                                   title = title,
                                   pdfOutput = pdfOutput,
                                   titleFont = REPORT.ssTitleFont)

        #### Finish Up ####
        ARCPY.AddMessage(fileName)
        pdfOutput.close()
        ARCPY.SetProgressorPosition()
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:104,代码来源:MoransI_Increment.py

示例4: construct

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import formatValue [as 别名]
    def construct(self):
        """Constructs the neighborhood structure for each feature and
        dispatches the appropriate values for the calculation of the
        statistic."""

        #### Shorthand Attributes ####
        ssdo = self.ssdo
        numObs = ssdo.numObs
        master2Order = ssdo.master2Order
        masterField = ssdo.masterField
        concept = self.concept
        iterVals = range(numObs)
        rowStandard = self.rowStandard
        wType = 1

        yVar = NUM.var(self.y)
        if NUM.isnan(yVar) or yVar <= 0.0:
            ARCPY.AddIDMessage("ERROR", 906)
            raise SystemExit()

        #### Create Deviation Variables ####
        self.yBar = NUM.mean(self.y)
        self.yDev = self.y - self.yBar

        #### Create Results Array ####
        self.giResults = NUM.zeros((self.nIncrements, 6))

        #### Run Max Distance and Bin NN ####
        msgProg = ARCPY.GetIDMessage(84423)
        self.rowSum = NUM.zeros((numObs, self.nIncrements), float)
        self.weightVals = NUM.ones((numObs, self.nIncrements), float)
        self.noNeighs = NUM.zeros((self.nIncrements,), int)
        self.breaks = COLL.defaultdict(NUM.array)
        self.numFeatures = NUM.ones((self.nIncrements,), int) * ssdo.numObs
        self.totalNeighs = NUM.zeros((self.nIncrements,), float)
        ARCPY.SetProgressor("step", msgProg, 0, ssdo.numObs, 1)
        if not self.silent:
            ARCPY.AddMessage("\n" + msgProg)
        gaSearch = GAPY.ga_nsearch(ssdo.gaTable)
        gaSearch.init_nearest(self.stepMax, 0, concept.lower())
        gaTable = ssdo.gaTable
        numCalcs = 0
        warnThrown = (self.silent == True) or (self.allDefaults == True)
        self.warnNeighsExceeded = warnThrown
        self.maxNeighsExceeded = warnThrown
        self.completed = False

        nb = ARC._ss.NeighborBins(gaTable, gaSearch, self.cutoffs)
        c = 0
        for counts, breaks in nb:
            numDists = len(breaks)
            if numDists:
                #### Add Warning if Possibly Going to Run out of Memory ####
                numCalcs += numDists
                if numCalcs > 20000000 and not warnThrown:
                    if not self.silent:
                        ARCPY.AddIDMessage("WARNING", 1389)
                    warnThrown = True

                self.breaks[c] = breaks
                noNeighInd = NUM.where(counts == 0)[0]
                if len(noNeighInd):
                    for noInd in noNeighInd:
                        self.noNeighs[noInd] += 1
                        self.numFeatures[noInd] -= 1
                if rowStandard:
                    self.weightVals[c] = 1./counts
                    self.rowSum[c] = 1.0
                else:
                    self.rowSum[c] = counts * 1.0
                self.totalNeighs += counts
            else:
                #### Never Included in Spatial Autocorrelation ####
                for ind in xrange(self.nIncrements):
                    self.noNeighs[ind] += 1
                    self.numFeatures[ind] -= 1

            #### Warn Number of Neighs ####
            if numDists >= WU.warnNumberOfNeighbors:
                self.idsWarn.append(self.ssdo.order2Master[c])
                if not self.warnNeighsExceeded:
                    ARCPY.AddIDMessage("WARNING", 1420,
                                       WU.warnNumberOfNeighbors)
                    self.warnNeighsExceeded = True
            c += 1
            ARCPY.SetProgressorPosition()
        
        #### Report if All Features Have No Neighbors ####
        self.s0 = self.rowSum.sum(0)
        noNeighsAllInd = NUM.where(self.s0 == 0.0)[0]
        if len(noNeighsAllInd):
            cutoffNoNeighs = self.cutoffs[noNeighsAllInd]
            dist = [UTILS.formatValue(i, "%0.2f") for i in cutoffNoNeighs]
            distanceStr = ", ".join(dist)
            ARCPY.AddIDMessage("ERROR", 1388, distanceStr)
            raise SystemExit()

        #### Report on Features with Large Number of Neighbors ####
        throwWarnings = (self.silent == True) or (self.allDefaults == True)
        if not throwWarnings:
#.........这里部分代码省略.........
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:103,代码来源:MoransI_Increment.py

示例5: endSummary

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import formatValue [as 别名]
    def endSummary(self):
        """Creates End Summary for Report File."""

        #### Passing Model Global Summary ####
        passHeader = ARCPY.GetIDMessage(84294)
        emptyValue = ARCPY.GetIDMessage(84092)
        perfectMultiStr = ARCPY.GetIDMessage(84368)
        perfectInterStr = ARCPY.GetIDMessage(84369)
        perfectInterStr += " (%s)" % LOCALE.format("%0.2f", 100)

        passResults = [ [ARCPY.GetIDMessage(84295),
                         ARCPY.GetIDMessage(84296),
                         ARCPY.GetIDMessage(84297),
                         ARCPY.GetIDMessage(84298),
                         ARCPY.GetIDMessage(84299)] ]

        cutoffList = [ "> " + UTILS.formatValue(self.minR2, "%0.2f"),
                       "< " + UTILS.formatValue(self.maxCoef, "%0.2f"),
                       "< " + UTILS.formatValue(self.maxVIF, "%0.2f"),
                       "> " + UTILS.formatValue(self.minJB, "%0.2f"),
                       "> " + UTILS.formatValue(self.minMI, "%0.2f") ]

        categories = [ARCPY.GetIDMessage(84300), ARCPY.GetIDMessage(84301),
                      ARCPY.GetIDMessage(84302), ARCPY.GetIDMessage(84303),
                      ARCPY.GetIDMessage(84304)]

        boolPerc = [ returnPerc(i, self.sumRuns) for i in self.boolResults ]
        boolPerc.append( returnPerc(self.sumMoranPass, self.sumMoranRuns) )
        boolOut = list(self.boolResults) + [self.sumMoranPass]
        sumOut = [ self.sumRuns for i in self.boolResults ]
        sumOut += [self.sumMoranRuns]

        for ind, category in enumerate(categories):
            outValue = LOCALE.format("%0.2f", boolPerc[ind])
            outCutoff = cutoffList[ind]
            outTrial = sumOut[ind]
            outCount = boolOut[ind]
            passResults.append( [category, outCutoff, outTrial,
                                 outCount, outValue] )

        self.passReport = UTILS.outputTextTable(passResults,
                                        header = passHeader,
                                        pad = 1, justify = "right")

        ##### Variable Significance and VIF Reports ####
        ##### Create Table Headers ####
        signHeader = ARCPY.GetIDMessage(84305)
        vifHeader = ARCPY.GetIDMessage(84306)

        #### Create Column Labels and Result Lists ####
        signColInfo = [ [ARCPY.GetIDMessage(84068), ARCPY.GetIDMessage(84307),
                         ARCPY.GetIDMessage(84366), ARCPY.GetIDMessage(84367)] ]
        signResults = []
        vifResults = [ [ARCPY.GetIDMessage(84068), ARCPY.GetIDMessage(84284),
                        ARCPY.GetIDMessage(84308), ARCPY.GetIDMessage(84309)] ]

        ##### Get Covariate Total ####
        percVarRes = []
        totalTogether = 0
        for resultKey, result in UTILS.iteritems(self.resultDict):
            totalTogether += result.eachAppears

        ##### Populate Result Lists ####
        for ind, varName in enumerate(self.independentVars):
            totalNeg = 0
            totalPos = 0
            totalSign = 0
            totalRan = 0
            totalViolations = 0
            totalCovariates = COLL.defaultdict(int)
            for resultKey, result in UTILS.iteritems(self.resultDict):
                #### Significance Results ####
                numRan, numSign = result.signDict[varName]
                totalSign += numSign
                totalRan += numRan
                numNeg, numPos = result.varSignDict[varName]
                totalNeg += numNeg
                totalPos += numPos

                #### VIF Results ####
                numViolate, covariates = result.vifDict[varName]
                totalViolations += numViolate
                for covariate in covariates:
                    if covariate != varName:
                        totalCovariates[covariate] += 1

            #### Add Perfect Multicollinearity Results * ####
            successfulRun = totalRan > 0

            #### Complete Significance Row ####
            if successfulRun:
                percentSign = ((totalSign * 1.0) / totalRan) * 100.0
                percentNeg = ((totalNeg * 1.0) / totalRan) * 100.0
                percentPos = ((totalPos * 1.0) / totalRan) * 100.0
                rowRes = [varName, LOCALE.format("%0.2f", percentSign),
                          LOCALE.format("%0.2f", percentNeg),
                          LOCALE.format("%0.2f", percentPos)]
            else:
                percentSign = -1.0
                rowRes = [varName, emptyValue, emptyValue, emptyValue]
#.........这里部分代码省略.........
开发者ID:f-tonini,项目名称:Python-Scripts,代码行数:103,代码来源:ModelSelectionOLS.py

示例6: createDiagnosticReport

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import formatValue [as 别名]
    def createDiagnosticReport(self):
        """Creates a formatted summary table of the OLS
        diagnostics."""

        #### Create PValue Array ####
        allPVals = NUM.array( [self.fProb, self.waldProb,
                               self.BPProb, self.JBProb] )

        #### Check For Any Significance for Extra Padding ####
        signFlag = NUM.any(allPVals <= 0.05)

        #### Table Title ####
        header = ARCPY.GetIDMessage(84076)
        feet = [84104, 84105, 84106, 84107]
        feet = [ ARCPY.GetIDMessage(i) for i in feet ]
        dFoot, eFoot, fFoot, gFoot = feet
        dFoot = ARCPY.GetIDMessage(84104)

        row1 = [UTILS.addColon(ARCPY.GetIDMessage(84253)),
                self.ssdo.inName,
                '  ' + UTILS.addColon(ARCPY.GetIDMessage(84254)),
                UTILS.padValue(self.depVarName, significant = signFlag)]

        aiccLab = ARCPY.GetIDMessage(84251) + " " + dFoot
        row2 = [UTILS.addColon(ARCPY.GetIDMessage(84093)),
                str(self.n), '  ' + UTILS.addColon(aiccLab),
                UTILS.padValue(UTILS.formatValue(self.aicc),
                               significant = signFlag)]

        r2Lab = ARCPY.GetIDMessage(84019) + " " + dFoot
        adjR2Lab = ARCPY.GetIDMessage(84022) + " " + dFoot
        row3 = [UTILS.addColon(r2Lab), UTILS.formatValue(self.r2),
                '  ' + UTILS.addColon(adjR2Lab),
                UTILS.padValue(UTILS.formatValue(self.r2Adj),
                               significant = signFlag)]

        fdofLab = ARCPY.GetIDMessage(84028)
        fLab = ARCPY.GetIDMessage(84025) + " " + eFoot
        row4 = [UTILS.addColon(fLab), UTILS.formatValue(self.fStat),
                "  " + UTILS.addColon(fdofLab.format(self.q, self.dof)),
                UTILS.writePVal(self.fProb, padNonSig = True)]

        chiMess = ARCPY.GetIDMessage(84034)
        wLab = ARCPY.GetIDMessage(84031) + " " + eFoot
        row5 = [UTILS.addColon(wLab), UTILS.formatValue(self.waldStat),
                "  " + UTILS.addColon(chiMess.format(self.q)),
                UTILS.writePVal(self.waldProb, padNonSig = True)]

        kLab = ARCPY.GetIDMessage(84037) + " " + fFoot
        row6 = [UTILS.addColon(kLab), UTILS.formatValue(self.BP),
                '  '+ UTILS.addColon(chiMess.format(self.q)),
                UTILS.writePVal(self.BPProb, padNonSig = True)]

        jbLab = ARCPY.GetIDMessage(84043) + " " + gFoot
        row7 = [UTILS.addColon(jbLab), UTILS.formatValue(self.JB),
                '  '+ UTILS.addColon(chiMess.format(2)),
                UTILS.writePVal(self.JBProb, padNonSig = True)]

        #### Finalize Diagnostic Table ####
        diagTotal = [ row1, row2, row3, row4, row5, row6, row7 ]
        diagJustify = ["left", "right", "left", "right"]

        self.diagTable = UTILS.outputTextTable(diagTotal,
                                header = header, pad = 1,
                                justify = diagJustify)
        self.diagRaw = diagTotal
        self.diagJustify = diagJustify
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:69,代码来源:OLS.py

示例7: report

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import formatValue [as 别名]
    def report(self):
        #### Report Strings Across Tables ####
        minStr = ARCPY.GetIDMessage(84271)
        maxStr = ARCPY.GetIDMessage(84272)
        meanStr = ARCPY.GetIDMessage(84261)
        stdStr = ARCPY.GetIDMessage(84509)
        attStr = ARCPY.GetIDMessage(84507)
        inStr = ARCPY.GetIDMessage(84508)

        #### Warn that Targets are Average of Inputs ####
        if self.ssdoBase.numObs > 1:
            ARCPY.AddIDMessage("WARNING", 1583)

            #### Additional Averaged Summary ####
            title = ARCPY.GetIDMessage(84503)
            avgList = [ [attStr, minStr, maxStr, stdStr, meanStr] ]
            for ind, fieldName in enumerate(self.fieldNames):
                avgList.append( [fieldName, 
                            UTILS.formatValue(self.baseMin[ind], "%0.4f"), 
                            UTILS.formatValue(self.baseMax[ind], "%0.4f"), 
                            UTILS.formatValue(self.baseStd[ind], "%0.4f"), 
                            UTILS.formatValue(self.baseMean[ind], "%0.4f") ] )

            outputTable = UTILS.outputTextTable(avgList, header = title,
                                                pad = 1,
                                                justify = ['left', 'right',
                                                           'right', 'right', 
                                                           'right'])
            ARCPY.AddMessage(outputTable)

        #### Attribute Summary ####
        title = ARCPY.GetIDMessage(84504)
        avgList = [ [attStr, minStr, maxStr, stdStr, meanStr, inStr] ]
        for ind, fieldName in enumerate(self.fieldNames):
            avgList.append( [fieldName, 
                        UTILS.formatValue(self.attMin[ind], "%0.4f"), 
                        UTILS.formatValue(self.attMax[ind], "%0.4f"), 
                        UTILS.formatValue(self.attStd[ind], "%0.4f"), 
                        UTILS.formatValue(self.attMean[ind], "%0.4f"),
                        UTILS.formatValue(self.baseMean[ind], "%0.4f") ] )

        outputTable = UTILS.outputTextTable(avgList, header = title,
                                            pad = 1,
                                            justify = ['left', 'right',
                                                       'right', 'right', 
                                                       'right', 'right'])
        ARCPY.AddMessage(outputTable)

        if self.numResults > ssMaxTextTableResults:
            firstLabel = "Top {0} of {1}".format(ssMaxTextTableResults,
                                               self.numResults)
            iters = ssMaxTextTableResults
        else:
            firstLabel = self.numResults
            iters = self.numResults
        matchString = outputTabInfo[self.matchMethod]
        if self.similarType in ['MOST_SIMILAR', 'BOTH']:
            title = ARCPY.GetIDMessage(84505).format(firstLabel, 
                                                     matchString)
            withinSS = self.totalDist[self.topIDs[:iters]].sum()
            outNames = ["OID"] + matchFieldInfo['MOST_SIMILAR'][0:-1]
            tableRows = [ outNames ]
        
            for ind in xrange(iters):
                orderID = self.topIDs[ind]
                rank = str(ind+1)
                masterID = str(self.ssdoCand.order2Master[orderID])
                ss = UTILS.formatValue(self.totalDist[orderID], "%0.4f")
                rowInfo = [masterID, rank, ss]
                tableRows.append(rowInfo)


            fin =  ["", "", UTILS.formatValue(withinSS, "%0.4f")]
            tableRows.append(fin)

            topTable = UTILS.outputTextTable(tableRows, header = title,
                                             justify = "right", pad = 1)
            ARCPY.AddMessage(topTable)

        if self.similarType in ['LEAST_SIMILAR', 'BOTH']:
            title = ARCPY.GetIDMessage(84506).format(firstLabel, 
                                                     matchString)
            withinSS = self.totalDist[self.botIDs[:iters]].sum()
            outNames = ["OID"] + matchFieldInfo['LEAST_SIMILAR'][0:-1]
            tableRows = [ outNames ]
        
            for ind in xrange(iters):
                orderID = self.botIDs[ind]
                rank = str(ind+1)
                masterID = str(self.ssdoCand.order2Master[orderID])
                ss = UTILS.formatValue(self.totalDist[orderID], "%0.4f")
                rowInfo = [masterID, rank, ss]
                tableRows.append(rowInfo)


            fin =  ["", "", UTILS.formatValue(withinSS, "%0.4f")]
            tableRows.append(fin)

            topTable = UTILS.outputTextTable(tableRows, header = title,
                                             justify = "right", pad = 1)
#.........这里部分代码省略.........
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:103,代码来源:Similarity.py


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