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


Python SSUtilities类代码示例

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


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

示例1: setStudyArea

    def setStudyArea(self):
        """Sets the study area for the nearest neighbor stat."""

        #### Attribute Shortcuts ####
        ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84248))
        ssdo = self.ssdo

        if self.studyArea == None:
            #### Create Min Enc Rect ####
            studyAreaFC = UTILS.returnScratchName("regularBound_FC")
            clearedMinBoundGeom = UTILS.clearExtent(UTILS.minBoundGeomPoints)
            clearedMinBoundGeom(ssdo.xyCoords, studyAreaFC, 
                                geomType = "RECTANGLE_BY_AREA",
                                spatialRef = ssdo.spatialRef)
            polyInfo = UTILS.returnPolygon(studyAreaFC, 
                                           spatialRef = ssdo.spatialRefString,
                                           useGeodesic = ssdo.useChordal)
            studyAreaPoly, studyArea = polyInfo
            UTILS.passiveDelete(studyAreaFC)

            if studyArea == None:
                #### Invalid Study Area ####
                ARCPY.AddIDMessage("Error", 932)
                raise SystemExit()

            self.studyArea = studyArea 
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:26,代码来源:NearestNeighbor.py

示例2: setupParameters

def setupParameters():
    """ Setup Parameters for Distance-based Weights Creation """
    
    #### Get User Provided Inputs ####
    inputFC = ARCPY.GetParameterAsText(0)
    outputFile = ARCPY.GetParameterAsText(1)
    distanceType = UTILS.getTextParameter(2).upper() #
    idField = UTILS.getTextParameter(3)
    
    #### Validate Input of Distance Type ####
    if not distanceType or distanceType not in DISTTYPE:
        ARCPY.AddError("Distance type is not set, or it is not in the "
                       "predefined list...")
        raise SystemExit()

    #### Setup Default Values of Threshold/KnnNum/InverseDist ####
    threshold = UTILS.getNumericParameter(4) \
        if distanceType == DISTTYPE[0] or distanceType == DISTTYPE[2] else None
    knnNum = UTILS.getNumericParameter(5) \
        if distanceType == DISTTYPE[1] else None
    inverseDist = UTILS.getNumericParameter(6) \
        if distanceType == DISTTYPE[2] else None
    
    #### Run Dist Weights Creation ####
    distW = DistW_PySAL(inputFC, outputFile, idField, distanceType, threshold,\
                        knnNum, inverseDist)
    
    #### Create Output ####
    distW.createOutput()
开发者ID:Esri,项目名称:PySAL-ArcGIS-Toolbox,代码行数:29,代码来源:DistWeightsCreator.py

示例3: __init__

    def __init__(self, allVarNames, numChoose, ssdo,
                 weightMatrix, weightsType = "SWM",
                 minR2 = .5, maxCoef = .01, maxVIF = 5.0,
                 minJB = .1, minMI = .1, silent = False):

        #### Set Initial Attributes ####
        UTILS.assignClassAttr(self, locals())

        #### Set Label ####
        self.numVars = len(self.allVarNames)

        self.label = ARCPY.GetIDMessage(84283).format(numChoose, self.numVars)
        if numChoose <= 2:
            self.eachAppears = 1
        else:
            self.eachAppears = nChooseK(self.numVars - 2, numChoose - 2)

        #### Set Result Structures ####
        self.varSignDict = {}
        self.signDict = {}
        self.vifDict = {}
        for varName in self.allVarNames:
            self.varSignDict[varName] = [0, 0]
            self.signDict[varName] = [0, 0]
            self.vifDict[varName] = [0, []]

        self.olsResults = {}
        self.bestR2Vals = []
        self.bestR2Res = []
        self.passTable = []
        self.passBools = []
        self.r2Residuals = NUM.empty((self.ssdo.numObs, 3), dtype = float)
        self.allJBPass = UTILS.compareFloat(0.0, self.minJB, rTol = .00000001)
        self.allMIPass = UTILS.compareFloat(0.0, self.minMI, rTol = .00000001)
        self.miVals = []
开发者ID:f-tonini,项目名称:Python-Scripts,代码行数:35,代码来源:ModelSelectionOLS.py

示例4: setupMedianCenter

def setupMedianCenter():
    """Retrieves the parameters from the User Interface and executes the
    appropriate commands."""

    inputFC = ARCPY.GetParameterAsText(0)
    outputFC = ARCPY.GetParameterAsText(1)
    weightField = UTILS.getTextParameter(2, fieldName = True)
    caseField = UTILS.getTextParameter(3, fieldName = True)        
    attFields = UTILS.getTextParameter(4, fieldName = True)   

    fieldList = []
    if weightField:
        fieldList.append(weightField)
    if caseField:
        fieldList.append(caseField)
    if attFields:
        attFields = attFields.split(";")
        fieldList = fieldList + attFields

    #### Populate SSDO with Data ####
    ssdo = SSDO.SSDataObject(inputFC, templateFC = outputFC,
                             useChordal = False)

    #### Populate SSDO with Data ####
    ssdo.obtainData(ssdo.oidName, fieldList, minNumObs = 1, dateStr = True) 

    #### Run Analysis ####
    mc = MedianCenter(ssdo, weightField = weightField,
                      caseField = caseField, attFields = attFields)

    #### Create Output ####
    mc.createOutput(outputFC)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:32,代码来源:MedianCenter.py

示例5: createInterpretReport

    def createInterpretReport(self):
        """Creates the interpretation table for OLS."""

        #### Generate Interpretation Table #####
        header =  ARCPY.GetIDMessage(84081)

        #### Set up Rows in Tables ####
        decimalSep = UTILS.returnDecimalChar()
        if decimalSep == ".":
            pValue = "0.01"
            VIF = "7.5"
        else:
            pValue = "0,01"
            VIF = "7,5"

        significance = [ARCPY.GetIDMessage(84111), ARCPY.GetIDMessage(84082).format(pValue)]
        coefficient = [ARCPY.GetIDMessage(84080), ARCPY.GetIDMessage(84349)]
        probs = [ARCPY.GetIDMessage(84086), ARCPY.GetIDMessage(84350).format(pValue)]
        multicoll = [ARCPY.GetIDMessage(84103), ARCPY.GetIDMessage(84083).format(VIF)]
        rSquared = [ARCPY.GetIDMessage(84104), ARCPY.GetIDMessage(84084)]
        jointFW = [ARCPY.GetIDMessage(84105), ARCPY.GetIDMessage(84085).format(pValue)]
        bpRow = [ARCPY.GetIDMessage(84106), ARCPY.GetIDMessage(84087).format(pValue)]
        jbRow = [ARCPY.GetIDMessage(84107), ARCPY.GetIDMessage(84088).format(pValue)]

        #### Finalize Interpretation Table ####
        intTotal = [significance, coefficient, probs, multicoll,
                    rSquared, jointFW, bpRow, jbRow]

        body = UTILS.outputTextTable(intTotal, pad = 1,
                                     justify = ["center", "left"])
        self.interpretTable = "\n%s%s" % (header, body)
        self.interpretRaw = intTotal
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:32,代码来源:OLS.py

示例6: validateRaster

    def validateRaster(self, ssdoCoords):

        printOHSSubject(84439, addNewLine = False)
        envMask = ARCPY.env.mask
        maskExists = False
        if envMask:
            try:
                descMask = ARCPY.Describe(envMask)
                maskExists = True
            except:
                maskExists = False

        if not envMask or not maskExists:
            #### Use Convex Hull ####
            msg = ARCPY.GetIDMessage(84440)
            ARCPY.SetProgressor("default", msg)
            printOHSAnswer(msg)
            boundaryFC = UTILS.returnScratchName("tempCH_FC")
            UTILS.minBoundGeomPoints(ssdoCoords, boundaryFC,
                                     geomType = "CONVEX_HULL",
                                     spatialRef = self.ssdo.spatialRef)
            self.boundaryFC = boundaryFC
            self.cleanUpList.append(boundaryFC)

        self.maskExists = maskExists
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:25,代码来源:OptimizedHotSpotAnalysis.py

示例7: createCoefficientTable

    def createCoefficientTable(self, tableName):
        """Creates Output Coefficient Database Table for OLS.

        INPUTS:
        tableName (str): catalog path to the output table
        """

        #### Set Progressor ####
        ARCPY.AddMessage(ARCPY.GetIDMessage(84071))
        ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84071))
        outPath, outName = OS.path.split(tableName)

        #### Set Up Field Names and Types ####
        inputFields = UTILS.getFieldNames(olsCoefFieldNames, outPath)
        inputTypes = ["TEXT", "DOUBLE", "DOUBLE",
                      "DOUBLE", "DOUBLE", "DOUBLE",
                      "DOUBLE", "DOUBLE", "DOUBLE"]

        #### Set Up Input Data ####
        inputData = []
        coefList = list(self.coef.flatten())
        for rowInd, rowVal in enumerate(coefList):
            inputData.append( (self.varLabels[rowInd], rowVal,
                               self.seCoef[rowInd], self.tStats[rowInd],
                               self.pVals[rowInd], self.seCoefRob[rowInd],
                               self.tStatsRob[rowInd], self.pValsRob[rowInd],
                               self.coefSTD[rowInd])
                             )

        #### Write Coefficient Table ####
        UTILS.createOutputTable(tableName, inputFields,
                                inputTypes, inputData)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:32,代码来源:OLS.py

示例8: len

    def doPoint2Poly(self):

        #### Initial Data Assessment ####
        printOHSSection(84428, prependNewLine = True)
        printOHSSubject(84431, addNewLine = False)
        self.ssdo.obtainData(self.ssdo.oidName)
        self.checkIncidents(self.ssdo.numObs)
        if len(self.ssdo.badRecords):
            ARCPY.AddMessage("\n")
        #################################

        #### Checking Polygon Message ####
        printOHSSubject(84430, addNewLine = False)

        #### Spatial Join (Hold Messages) ####
        outputFieldMaps = "EMPTY"
        tempFC = UTILS.returnScratchName("SpatialJoin_TempFC")
        self.cleanUpList.append(tempFC)
        joinWithSpatialRef = UTILS.funWithSpatialRef(ANA.SpatialJoin,
                                                     self.ssdo.spatialRef,
                                                     outputFC = tempFC)
        joinWithXY = UTILS.funWithXYTolerance(joinWithSpatialRef,
                                              self.ssdo.distanceInfo)
        joinWithXY(self.polygonFC, self.ssdo.inputFC, tempFC,
                   "JOIN_ONE_TO_ONE", "KEEP_ALL",
                   outputFieldMaps)

        #### Set VarName, MasterField, AnalysisSSDO ####
        self.createAnalysisSSDO(tempFC, "JOIN_COUNT")
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:29,代码来源:OptimizedHotSpotAnalysis.py

示例9: __init__

 def __init__(self, ssdo, weightsFile):
     #### Set Initial Attributes ####
     UTILS.assignClassAttr(self, locals())
     self.wPath, self.wName = OS.path.split(weightsFile)
     name, ext = OS.path.splitext(weightsFile.upper())
     self.wExt = ext.strip(".")
     self.setWeights()
开发者ID:Esri,项目名称:PySAL-ArcGIS-Toolbox,代码行数:7,代码来源:pysal2ArcUtils.py

示例10: __init__

    def __init__(self, ssdo, varName, outputFC, wType,
                 weightsFile = None, concept = "EUCLIDEAN",
                 rowStandard = True, threshold = None,
                 exponent = 1.0, permutations = None, 
                 applyFDR = False):

        #### Set Initial Attributes ####
        UTILS.assignClassAttr(self, locals())

        #### Assess Whether SWM File Being Used ####
        self.swmFileBool = False 
        if weightsFile:
            weightSuffix = weightsFile.split(".")[-1].lower()
            self.swmFileBool = (weightSuffix == "swm")

        #### Warn Inverse Distance if Geographic Coord System ####
        #if wType in [0, 7]:
        #    WU.checkGeographicCoord(self.ssdo.spatialRefType, 
        #                            WU.wTypeDispatch[wType])

        #### Create Shape File Boolean for NULL Values ####
        self.outShapeFileBool = UTILS.isShapeFile(outputFC)

        #### Initialize Data ####
        self.initialize()

        #### Construct Based on SWM File or On The Fly ####
        self.construct()
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:28,代码来源:LocalMoran.py

示例11: report

    def report(self, fileName = None):
        """Reports the Central Feature results as a message or to a file.

        INPUTS:
        fileName {str, None}: path to a text file to populate with results.
        """

        header = ARCPY.GetIDMessage(84200)
        columns = [ARCPY.GetIDMessage(84191), ARCPY.GetIDMessage(84201), 
                   ARCPY.GetIDMessage(84202)]
        results = [ columns ]
        for case in self.uniqueCases:
            if not self.caseField:
                strCase = "ALL"
            else:
                strCase = UTILS.caseValue2Print(case, self.caseIsString)
            cfOIDs, minSumDist = self.cf[case]
            cfOIDs = [ str(i) for i in cfOIDs ]
            cfOIDs = ", ".join(cfOIDs)
            rowResult = [ strCase, 
                          cfOIDs,
                          LOCALE.format("%0.6f", minSumDist) ]
            results.append(rowResult)

        outputTable = UTILS.outputTextTable(results, header = header)
        if fileName:
            f = UTILS.openFile(fileName, "w")
            f.write(outputTable)
            f.close()
        else:
            ARCPY.AddMessage(outputTable)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:31,代码来源:CentralFeature.py

示例12: setupStandardDistance

def setupStandardDistance():
    """Retrieves the parameters from the User Interface and executes the
    appropriate commands."""

    inputFC = ARCPY.GetParameterAsText(0)
    outputFC = ARCPY.GetParameterAsText(1)
    stdDeviations = ARCPY.GetParameterAsText(2).upper().replace(" ", "_")  
    weightField = UTILS.getTextParameter(3, fieldName = True)
    caseField = UTILS.getTextParameter(4, fieldName = True)           

    fieldList = []
    if weightField:
        fieldList.append(weightField)
    if caseField:
        fieldList.append(caseField)

    stdDeviations = circleDict[stdDeviations]

    #### Create a Spatial Stats Data Object (SSDO) ####
    ssdo = SSDO.SSDataObject(inputFC, templateFC = outputFC,
                             useChordal = False)

    #### Populate SSDO with Data ####
    ssdo.obtainData(ssdo.oidName, fieldList, minNumObs = 2, dateStr = True) 

    #### Run Analysis ####
    sd = StandardDistance(ssdo, weightField = weightField,
                          caseField = caseField, 
                          stdDeviations = stdDeviations)
    
    #### Create Output ####
    sd.createOutput(outputFC)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:32,代码来源:StandardDistance.py

示例13: report

    def report(self, fileName = None):
        """Reports the Standard Distance results as a message or to a file.

        INPUTS:
        fileName {str, None}: path to a text file to populate with results
        """

        header = ARCPY.GetIDMessage(84224)
        columns = [ARCPY.GetIDMessage(84191), ARCPY.GetIDMessage(84211),
                   ARCPY.GetIDMessage(84212), ARCPY.GetIDMessage(84225),
                   ARCPY.GetIDMessage(84226)]
        results = [columns]
        for case in self.uniqueCases:
            if not self.caseField:
                strCase = "ALL"
            else:
                strCase = UTILS.caseValue2Print(case, self.caseIsString)
            meanX, meanY = self.meanCenter[case]
            rowResult = [ strCase, LOCALE.format("%0.6f", meanX),
                          LOCALE.format("%0.6f", meanY),
                          LOCALE.format("%0.6f", self.sd[case]),
                          LOCALE.format("%0.1f", self.stdDeviations) ]
            results.append(rowResult)

        outputTable = UTILS.outputTextTable(results, header = header)
        if fileName:
            f = UTILS.openFile(fileName, "w")
            f.write(outputTable)
            f.close()
        else:
            ARCPY.AddMessage(outputTable)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:31,代码来源:StandardDistance.py

示例14: report

    def report(self):
        """Reports the results from exploratory regression analysis."""

        #### Set Title ####
        title = self.label

        #### Column Labels ####
        labs = [ARCPY.GetIDMessage(84021), ARCPY.GetIDMessage(84249),
                ARCPY.GetIDMessage(84042), ARCPY.GetIDMessage(84036),
                ARCPY.GetIDMessage(84284), ARCPY.GetIDMessage(84292),
                ARCPY.GetIDMessage(84286)]
        r2Info = [ labs ]

        #### Adjusted R2, Sorted Highest to Lowest with ID Tie Breaks ####
        header = ARCPY.GetIDMessage(84287)
        numRes = UTILS.ssRange(len(self.bestR2Res))
        r2Data = []
        for i in numRes:
            r2Val = self.bestR2Vals[i]
            idVal = int(self.bestR2Res[i].split(":")[-1])
            r2Data.append((r2Val, idVal))
        r2Data = NUM.array(r2Data, dtype = [('r2', float), ('ids', int)])
        r2SortedInds = r2Data.argsort(order = ('r2', 'ids'))
        sortIndex = reversed(r2SortedInds)
        for ind in sortIndex:
            olsID = self.bestR2Res[ind]
            olsRes = self.olsResults[olsID]
            olsOut = olsRes.report(formatStr = "%0.2f")
            r2Info.append(olsOut)

        r2Report = UTILS.outputTextTable(r2Info, header = header,
                                         justify = masterJustify)

        #### Passing Models ####
        header = ARCPY.GetIDMessage(84288)
        passList = [ labs ]
        r2Values = []
        olsIDs = []
        for olsID in self.passBools:
            olsRes = self.olsResults[olsID]
            r2Values.append(olsRes.r2)
            olsIDs.append(olsID)
        sortIndex = NUM.argsort(r2Values).tolist()
        sortIndex.reverse()
        for ind in sortIndex:
            olsID = olsIDs[ind]
            olsRes = self.olsResults[olsID]
            olsOut = olsRes.report(formatStr = "%0.6f")
            passList.append(olsOut)

        passingReport = UTILS.outputTextTable(passList, header = header)

        #### Print Report ####
        starMess = ARCPY.GetIDMessage(84289) * 78
        finalReport = [starMess, title, r2Report, passingReport]
        finalReport = "\n".join(finalReport)
        finalReport = finalReport + "\n"
        ARCPY.AddMessage(finalReport)

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

示例15: report

    def report(self, fileName = None):
        """Reports the Median Center results as a message or to a file.

        INPUTS:
        fileName {str, None}: path to a text file to populate with results
        """

        header = ARCPY.GetIDMessage(84190)
        columns = [ARCPY.GetIDMessage(84191), ARCPY.GetIDMessage(84192), 
                   ARCPY.GetIDMessage(84193)]
        if self.attFields:
            for attField in self.attFields:
                columns.append(ARCPY.GetIDMessage(84194).format(attField))
        results = [ columns ]
        for case in self.uniqueCases:
            if not self.caseField:
                strCase = "ALL"
            else:
                strCase = UTILS.caseValue2Print(case, self.caseIsString)
            medX, medY = self.medianCenter[case]
            rowResult = [ strCase, LOCALE.format("%0.6f", medX),
                          LOCALE.format("%0.6f", medY) ]
            if self.attFields:
                for attInd, attField in enumerate(self.attFields):
                    medAtt = self.attCenter[case][attInd]
                    rowResult.append(LOCALE.format("%0.6f", medAtt))
            results.append(rowResult)

        outputTable = UTILS.outputTextTable(results, header = header)
        if fileName:
            f = open(fileName, "w")
            f.write(outputTable)
            f.close()
        else:
            ARCPY.AddMessage(outputTable)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:35,代码来源:MedianCenter.py


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