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


Python SSUtilities.setUniqueIDField方法代码示例

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


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

示例1: initialize

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import setUniqueIDField [as 别名]
 def initialize(self):
     """Performs additional validation and populates the  SSDataObject."""
     ARCPY.SetProgressor("default", ("Starting to create contiguity-based "
                                     "weights. Loading features..."))
     
     #### Shorthand Attributes ####
     idField = self.idField
     inputFC = self.inputFC
     
     #### Create SSDataObject ####
     self.ssdo = SSDO.SSDataObject(inputFC)
     ssdo = self.ssdo
     
     #### Raise Error If Valid Unique ID Not Provided ####
     masterField = idField
     if not masterField:
         if self.outputExt in EXTENSIONS[1:]:
             msg = ("The unique ID Field is required to create GWT and/or "
                    "SWM spatial weights files...")
             ARCPY.AddError(msg)
             raise SystemExit()
         else:
             msg = ("The unique ID Field is not provided. The zero-based "
                    "indexing order will be used to create the spatial "
                    "weights file.")
             ARCPY.AddWarning(msg)
             masterField = UTILS.setUniqueIDField(ssdo)
             
     #### Populate SSDO with Data ####
     ssdo.obtainData(masterField)
     self.masterField = masterField
开发者ID:gdherbert,项目名称:PySAL-ArcGIS-Toolbox,代码行数:33,代码来源:ContWeightsCreator.py

示例2: setUniqueIDField

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import setUniqueIDField [as 别名]
def setUniqueIDField(ssdo, weightsFile):
    """Replace SSUTILITIES.setUniqueIDField to support flexible weights file 
    headers."""
    if weightsFile == None:
        return ssdo.oidName
    
    weightsSuffix = weightsFile.split(".")[-1].lower()
    swmFileBool = (weightsSuffix == "swm")
    
    if swmFileBool:
        return UTILS.setUniqueIDField(ssdo, weightsFile)
    
    fo = UTILS.openFile(weightsFile, "r")
    header = fo.readline().strip()
    headerItems = header.split(" ") 
    
    if len(headerItems) == 1 and weightsSuffix == "gal":
        return ssdo.oidName
    
    elif len(headerItems) > 1:
        for item in headerItems:
            if not item.isdigit() and item.lower() != "unknown" \
               and len(item) > 0:
                masterField = item
                # check to see if in ssdo
                for fieldName, fieldObj in ssdo.allFields.items():
                    if fieldObj.baseName.upper() == masterField.upper():
                        return masterField
                    
    msg = "Header is not valid in Weights file (%s)." % weightsFile
    ARCPY.AddWarning(msg)
开发者ID:Esri,项目名称:PySAL-ArcGIS-Toolbox,代码行数:33,代码来源:pysal2ArcUtils.py

示例3: setAnalysisSSDO

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import setUniqueIDField [as 别名]
    def setAnalysisSSDO(self, tempFC, varName):
        #### Initial Data Assessment ####
        printOHSSection(84428, prependNewLine = True)

        self.varName = varName
        self.analysisSSDO = self.ssdo
        self.masterField = UTILS.setUniqueIDField(self.analysisSSDO)
        if UTILS.renderType[self.ssdo.shapeType.upper()]:
            stringShape =  ARCPY.GetIDMessage(84502)
        else:
            stringShape =  ARCPY.GetIDMessage(84501)

        #### Assure Enough Features (Q) ####
        printOHSSubject(84429, addNewLine = False)
        self.analysisSSDO.obtainDataGA(self.masterField, [self.varName])
        if len(self.analysisSSDO.badRecords):
            ARCPY.AddMessage("\n")
        if self.analysisSSDO.numObs < 30:
            ARCPY.AddIDMessage("ERROR", 1571, '30', stringShape)
            self.cleanUp()
            raise SystemExit()

        msg = ARCPY.GetIDMessage(84485).format(self.analysisSSDO.numObs)
        printOHSAnswer(msg)

        #### Errors and Warnings ####
        printOHSSubject(84432, addNewLine = False)
        y = self.analysisSSDO.fields[self.varName].returnDouble()
        yVar = NUM.var(y)

        #### Zero Variance ####
        if NUM.isnan(yVar) or yVar <= 0.0:
            ARCPY.AddIDMessage("ERROR", 1575)
            self.cleanUp()
            raise SystemExit()

        #### Analysis Var Description ####
        msg = ARCPY.GetIDMessage(84446).format(self.varName)
        printOHSAnswer(msg, addNewLine = False)
        printWeightAnswer(y)

        #### Locational Outliers ####
        lo = UTILS.LocationInfo(self.analysisSSDO, concept = "EUCLIDEAN",
                                silentThreshold = True, stdDeviations = 3)
        printOHSLocationalOutliers(lo, aggType = 2)

        #### Raster Boundary ####
        if self.outputRaster:
            self.validateRaster(self.analysisSSDO.xyCoords)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:51,代码来源:OptimizedHotSpotAnalysis.py

示例4: loadWeights

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import setUniqueIDField [as 别名]
    def loadWeights(self):
        """ Convert Weights by Reading From Input Weights File """
        
        ARCPY.SetProgressor("default", \
                            "Loading original spatial weights file...")
        
        #### Shorthand Attributes ####
        ssdo = self.ssdo
        weightObj = self.weightObj
        inputFC = self.inputFC
        inputExt = self.inputExt
        inputFile = self.inputFile
        inputIDField = self.inputIDField
        fileIDField = self.fileIDField
        
        weight2Master = None
        
        #### If FC and IDField are Required and Provided ####
        if inputIDField and inputFC:
            ssdo = SSDO.SSDataObject(inputFC)
            masterField = fileIDField if fileIDField else \
                UTILS.setUniqueIDField(ssdo) # 0-based Weights
            ssdo.obtainData(masterField, fields=[inputIDField])
            
            # Create Mapping From Weights IDs to Master IDs
            weight2Master = {}
            isGDB = (0 not in ssdo.master2Order)
            for weightKey in ssdo.master2Order.keys():
                weight2Master[weightKey-1 if isGDB and not fileIDField \
                              else weightKey] = \
                    ssdo.fields[inputIDField].data[ssdo.master2Order[weightKey]]

        #### Create WeightObj from Input File ####    
        weightObj = AUTILS.swm2Weights(inputFile, master2Order=weight2Master) \
            if inputExt == EXTENSIONS[3] else \
            AUTILS.text2Weights(inputFile, master2Order=weight2Master)
    
        #### Save weightObj Class Object for Writing Result #### 
        self.weightObj = weightObj
开发者ID:gdherbert,项目名称:PySAL-ArcGIS-Toolbox,代码行数:41,代码来源:WeightConvertor.py

示例5: initialize

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import setUniqueIDField [as 别名]
 def initialize(self): 
     """Performs additional validation and populates the 
     SSDataObject."""
     ARCPY.SetProgressor("default", \
                         "Starting to create distance-based weights. "
                         "Loading features...")
     
     #### Shorthand Attributes ####
     idField = self.idField
     inputFC= self.inputFC
     
     #### Create SSDataObject ####
     self.ssdo = SSDO.SSDataObject(inputFC)
     ssdo = self.ssdo
     
     #### Raise Error If Valid Unique ID Not Provided ####
     masterField = idField
     if not masterField:
         if self.outputExt in EXTENSIONS[1:]:
             msg = ("The unique ID Field is required to create GWT and/or "
                    "SWM spatial weights files...")
             ARCPY.AddError(msg)
             raise SystemExit()
         else:
             msg = ("The unique ID Field is not provided. The zero-based "
                    "indexing order will be used to create the spatial "
                    "weights file.")
             ARCPY.AddWarning(msg)
             masterField = UTILS.setUniqueIDField(ssdo)
         
     #### Populate SSDO with Data ####
     ssdo.obtainData(masterField)
     
     #### Raise Warning for POLYGON data ####
     if ssdo.shapeType == 'Polygon':
         ARCPY.AddWarning(("Input Shapefile contains polygon data. The "
                           "centroids of polygons would be used for "
                           "calculation..."))
开发者ID:Esri,项目名称:PySAL-ArcGIS-Toolbox,代码行数:40,代码来源:DistWeightsCreator.py

示例6: setupGlobalI_Increment

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import setUniqueIDField [as 别名]
def setupGlobalI_Increment():
    """Retrieves the parameters from the User Interface and executes the
    appropriate commands."""

    #### Input Features and Variable ####
    inputFC = ARCPY.GetParameterAsText(0)
    varName = ARCPY.GetParameterAsText(1).upper()

    #### Number of Distance Thresholds ####
    nIncrements = UTILS.getNumericParameter(2)
    if nIncrements > 30:
        nIncrements = 30

    #### Starting Distance ####
    begDist = UTILS.getNumericParameter(3)

    #### Step Distance ####
    dIncrement = UTILS.getNumericParameter(4)

    #### EUCLIDEAN or MANHATTAN ####
    distanceConcept = ARCPY.GetParameterAsText(5).upper().replace(" ", "_")
    concept = WU.conceptDispatch[distanceConcept]

    #### Row Standardized ####
    rowStandard = ARCPY.GetParameter(6)

    #### Output Table ####
    outputTable = UTILS.getTextParameter(7)

    #### Report File ####
    reportFile = UTILS.getTextParameter(8)

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

    #### Set Unique ID Field ####
    masterField = UTILS.setUniqueIDField(ssdo)

    #### Populate SSDO with Data ####
    ssdo.obtainDataGA(masterField, [varName], minNumObs = 4,
                      warnNumObs = 30)

    #### Run Analysis ####
    gi = GlobalI_Step(ssdo, varName, nIncrements = nIncrements,
                      begDist = begDist, dIncrement = dIncrement,
                      concept = concept, rowStandard = rowStandard)

    #### Report Results ####
    reportTable = gi.report()

    #### Optionally Create Output ####
    if outputTable:
        outputTable, dbf = gi.createOutput(outputTable)
        if dbf:
            ARCPY.SetParameterAsText(7, outputTable)

    if reportFile:
        gi.createOutputGraphic(reportFile, gi.firstPeakInd, gi.maxPeakInd)

    #### Set Peak Distances ####
    firstPeak = gi.firstPeakDistance
    if firstPeak == None:
        firstPeak = ""
    ARCPY.SetParameterAsText(9, firstPeak)

    maxPeak = gi.maxPeakDistance
    if maxPeak == None:
        maxPeak = ""
    ARCPY.SetParameterAsText(10, maxPeak)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:71,代码来源:MoransI_Increment.py

示例7: setupLocalI

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import setUniqueIDField [as 别名]
def setupLocalI():
    """Retrieves the parameters from the User Interface and executes the
    appropriate commands."""

    inputFC = ARCPY.GetParameterAsText(0)                    
    varName = ARCPY.GetParameterAsText(1).upper()              
    outputFC = ARCPY.GetParameterAsText(2)

    #### Parse Space Concept ####
    spaceConcept = ARCPY.GetParameterAsText(3).upper().replace(" ", "_")
    if spaceConcept == "INVERSE_DISTANCE_SQUARED":
        exponent = 2.0
    else:
        exponent = 1.0
    try:
        spaceConcept = WU.convertConcept[spaceConcept] 
        wType = WU.weightDispatch[spaceConcept]
    except:
        ARCPY.AddIDMessage("Error", 723)
        raise SystemExit()

    #### EUCLIDEAN or MANHATTAN ####
    distanceConcept = ARCPY.GetParameterAsText(4).upper().replace(" ", "_")
    concept = WU.conceptDispatch[distanceConcept]

    #### Row Standardized ####
    rowStandard = ARCPY.GetParameterAsText(5).upper()
    if rowStandard == 'ROW':
        rowStandard = True
    else:
        rowStandard = False

    #### Distance Threshold ####
    threshold = UTILS.getNumericParameter(6)

    #### Spatial Weights File ####
    weightsFile = UTILS.getTextParameter(7)    
    if weightsFile == None and wType == 8:
        ARCPY.AddIDMessage("ERROR", 930)
        raise SystemExit()
    if weightsFile and wType != 8:
        ARCPY.AddIDMessage("WARNING", 925)
        weightsFile = None

    #### FDR ####
    applyFDR = ARCPY.GetParameter(8)

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

    #### Set Unique ID Field ####
    masterField = UTILS.setUniqueIDField(ssdo, weightsFile = weightsFile)

    #### Populate SSDO with Data ####
    if WU.gaTypes[spaceConcept]:
        ssdo.obtainDataGA(masterField, [varName], minNumObs = 3, 
                          warnNumObs = 30)
    else:
        ssdo.obtainData(masterField, [varName], minNumObs = 3, 
                        warnNumObs = 30)

    #### Run Cluster-Outlier Analysis ####
    li = LocalI(ssdo, varName, outputFC, wType,
                weightsFile = weightsFile, concept = concept,
                rowStandard = rowStandard, threshold = threshold, 
                exponent = exponent, applyFDR = applyFDR)

    #### Report and Set Parameters ####
    liField, ziField, pvField, coField = li.outputResults()
    try:
        ARCPY.SetParameterAsText(9, liField)
        ARCPY.SetParameterAsText(10, ziField)
        ARCPY.SetParameterAsText(11, pvField)
        ARCPY.SetParameterAsText(12, coField)
        ARCPY.SetParameterAsText(13, li.ssdo.masterField)
    except:
        ARCPY.AddIDMessage("WARNING", 902)

    li.renderResults()
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:82,代码来源:LocalMoran.py

示例8: setupGlobalI

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import setUniqueIDField [as 别名]
def setupGlobalI():
    """Retrieves the parameters from the User Interface and executes the
    appropriate commands."""

    inputFC = ARCPY.GetParameterAsText(0)                    
    varName = ARCPY.GetParameterAsText(1).upper()              
    displayIt = ARCPY.GetParameter(2) 

    #### Parse Space Concept ####
    spaceConcept = ARCPY.GetParameterAsText(3).upper().replace(" ", "_")
    if spaceConcept == "INVERSE_DISTANCE_SQUARED":
        exponent = 2.0
    else:
        exponent = 1.0
    try:
        spaceConcept = WU.convertConcept[spaceConcept] 
        wType = WU.weightDispatch[spaceConcept]
    except:
        ARCPY.AddIDMessage("Error", 723)
        raise SystemExit()

    #### EUCLIDEAN or MANHATTAN ####
    distanceConcept = ARCPY.GetParameterAsText(4).upper().replace(" ", "_")
    concept = WU.conceptDispatch[distanceConcept]

    #### Row Standardized ####
    rowStandard = ARCPY.GetParameterAsText(5).upper()
    if rowStandard == 'ROW':
        rowStandard = True
    else:
        rowStandard = False

    #### Distance Threshold ####
    threshold = UTILS.getNumericParameter(6)

    #### Spatial Weights File ####
    weightsFile = UTILS.getTextParameter(7)    
    if weightsFile == None and wType == 8:
        ARCPY.AddIDMessage("ERROR", 930)
        raise SystemExit()
    if weightsFile and wType != 8:
        ARCPY.AddIDMessage("WARNING", 925)
        weightsFile = None

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

    #### Set Unique ID Field ####
    masterField = UTILS.setUniqueIDField(ssdo, weightsFile = weightsFile)

    #### Populate SSDO with Data ####
    if WU.gaTypes[spaceConcept]:
        ssdo.obtainDataGA(masterField, [varName], minNumObs = 3, 
                          warnNumObs = 30)
    else:
        ssdo.obtainData(masterField, [varName], minNumObs = 3, 
                        warnNumObs = 30)

    #### Run Spatial Autocorrelation ####
    gi = GlobalI(ssdo, varName, wType, weightsFile = weightsFile, 
                 concept = concept, rowStandard = rowStandard, 
                 threshold = threshold, exponent = exponent)

    #### Report and Set Parameters ####
    giString, ziString, pvString = gi.report()
    try:
        ARCPY.SetParameterAsText(8, giString)
        ARCPY.SetParameterAsText(9, ziString)
        ARCPY.SetParameterAsText(10, pvString)
    except:
        ARCPY.AddIDMessage("WARNING", 902)

    #### Create HTML Output ####
    if displayIt:
        htmlOutFile = gi.reportHTML(htmlFile = None)
        ARCPY.SetParameterAsText(11, htmlOutFile)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:78,代码来源:MoransI.py

示例9: runExploratoryRegression

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import setUniqueIDField [as 别名]
def runExploratoryRegression():
    """Retrieves the parameters from the User Interface and executes the
    appropriate commands."""

    #### Get User Provided Inputs ####
    ARCPY.env.overwriteOutput = True
    inputFC = ARCPY.GetParameterAsText(0)
    dependentVar = ARCPY.GetParameterAsText(1).upper()
    independentVarsReg = ARCPY.GetParameterAsText(2)
    independentVars = independentVarsReg.upper().split(";")
    weightsFile = UTILS.getTextParameter(3)

    #### Derived Output ####
    outputReportFile = OS.path.join(ARCPY.env.scratchFolder, "ModelSelectionOLS.txt")

    #### Search Criterion ####
    maxIndVars = UTILS.getNumericParameter(5)
    minIndVars = UTILS.getNumericParameter(6)
    minR2 = UTILS.getNumericParameter(7)
    maxCoef = UTILS.getNumericParameter(8)
    maxVIF = UTILS.getNumericParameter(9)
    minJB = UTILS.getNumericParameter(10)
    minMI = UTILS.getNumericParameter(11)

    #### Create a Spatial Stats Data Object (SSDO) ####
    ssdo = SSDO.SSDataObject(inputFC)

    #### Set Unique ID Field ####
    masterField = UTILS.setUniqueIDField(ssdo, weightsFile = weightsFile)

    #### MasterField Can Not Be The Dependent Variable ####
    if masterField == dependentVar:
        ARCPY.AddIDMessage("ERROR", 945, masterField,
                           ARCPY.GetIDMessage(84112))
        raise SystemExit()

    #### Remove the MasterField from Independent Vars ####
    if masterField in independentVars:
        independentVars.remove(masterField)
        ARCPY.AddIDMessage("WARNING", 736, masterField)

    #### Remove the Dependent Variable from Independent Vars ####
    if dependentVar in independentVars:
        independentVars.remove(dependentVar)
        ARCPY.AddIDMessage("WARNING", 850, dependentVar)

    #### Raise Error If No Independent Vars ####
    if not len(independentVars):
        ARCPY.AddIDMessage("ERROR", 737)
        raise SystemExit()

    #### Obtain Data ####
    allVars = [dependentVar] + independentVars

    #### Populate SSDO with Data ####
    if not weightsFile:
        ssdo.obtainDataGA(masterField, allVars, minNumObs = 5,
                          warnNumObs = 30)
    else:
        ssdo.obtainData(masterField, allVars, minNumObs = 5,
                        warnNumObs = 30)

    ExploratoryRegression(ssdo, dependentVar,
                              independentVars,
                    weightsFile = weightsFile,
          outputReportFile = outputReportFile,
                      maxIndVars = maxIndVars,
                      minIndVars = minIndVars,
             minR2 = minR2, maxCoef = maxCoef,
               maxVIF = maxVIF, minJB = minJB,
                                minMI = minMI)

    #### Send Derived Output back to the tool ####
    ARCPY.SetParameterAsText(4, outputReportFile)
开发者ID:f-tonini,项目名称:Python-Scripts,代码行数:76,代码来源:ModelSelectionOLS.py

示例10: setupLocalG

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import setUniqueIDField [as 别名]
def setupLocalG():
    """Retrieves the parameters from the User Interface and executes the
    appropriate commands."""

    inputFC = ARCPY.GetParameterAsText(0)
    varName = ARCPY.GetParameterAsText(1).upper()
    varNameList = [varName]
    outputFC = ARCPY.GetParameterAsText(2)

    #### Parse Space Concept ####
    spaceConcept = ARCPY.GetParameterAsText(3).upper().replace(" ", "_")
    if spaceConcept == "INVERSE_DISTANCE_SQUARED":
        exponent = 2.0
    else:
        exponent = 1.0
    try:
        spaceConcept = WU.convertConcept[spaceConcept]
        wType = WU.weightDispatch[spaceConcept]
    except:
        ARCPY.AddIDMessage("ERROR", 723)
        raise SystemExit()

    #### EUCLIDEAN or MANHATTAN ####
    distanceConcept = ARCPY.GetParameterAsText(4).upper().replace(" ", "_")
    concept = WU.conceptDispatch[distanceConcept]

    #### Row Standardized Not Used in Hot Spot Analysis ####
    #### Results Are Identical With or Without ####
    #### Remains in UI for Backwards Compatibility ####
    rowStandard = ARCPY.GetParameterAsText(5).upper()

    #### Distance Threshold ####
    threshold = UTILS.getNumericParameter(6)

    #### Self Potential Field ####
    potentialField = UTILS.getTextParameter(7, fieldName=True)
    if potentialField:
        varNameList.append(potentialField)

    #### Spatial Weights File ####
    weightsFile = UTILS.getTextParameter(8)
    if weightsFile == None and wType == 8:
        ARCPY.AddIDMessage("ERROR", 930)
        raise SystemExit()
    if weightsFile and wType != 8:
        ARCPY.AddIDMessage("WARNING", 925)
        weightsFile = None

    #### FDR ####
    applyFDR = ARCPY.GetParameter(9)

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

    #### Set Unique ID Field ####
    masterField = UTILS.setUniqueIDField(ssdo, weightsFile=weightsFile)

    #### Populate SSDO with Data ####
    if WU.gaTypes[spaceConcept]:
        ssdo.obtainDataGA(masterField, varNameList, minNumObs=3, warnNumObs=30)
    else:
        ssdo.obtainData(masterField, varNameList, minNumObs=3, warnNumObs=30)

    #### Run Hot-Spot Analysis ####
    gi = LocalG(
        ssdo,
        varName,
        outputFC,
        wType,
        weightsFile=weightsFile,
        concept=concept,
        threshold=threshold,
        exponent=exponent,
        potentialField=potentialField,
        applyFDR=applyFDR,
    )

    #### Report and Set Parameters ####
    giField, pvField = gi.outputResults()
    try:
        ARCPY.SetParameterAsText(10, giField)
        ARCPY.SetParameterAsText(11, pvField)
        ARCPY.SetParameterAsText(12, gi.ssdo.masterField)
    except:
        ARCPY.AddIDMessage("WARNING", 902)

    gi.renderResults()
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:89,代码来源:Gi.py

示例11: createAnalysisSSDO

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import setUniqueIDField [as 别名]
    def createAnalysisSSDO(self, tempFC, varName):
        self.varName = varName
        self.analysisSSDO = SSDO.SSDataObject(tempFC,
                                   explicitSpatialRef = self.ssdo.spatialRef,
                                   useChordal = True)
        self.masterField = UTILS.setUniqueIDField(self.analysisSSDO)
        self.analysisSSDO.obtainDataGA(self.masterField, [self.varName])

        if self.aggType == 2:
            #### Verify Enough Polygons ####
            self.checkPolygons(self.analysisSSDO.numObs)

            #### Locational Outliers ####
            lo = UTILS.LocationInfo(self.analysisSSDO, concept = "EUCLIDEAN",
                                silentThreshold = True, stdDeviations = 3)
            printOHSLocationalOutliers(lo, aggType = self.aggType)

            #### Agg Header ####
            printOHSSection(84444)

            #### Do Spatial Join ####
            msg = ARCPY.GetIDMessage(84458)
            printOHSSubject(84458, addNewLine = False)
            msg = ARCPY.GetIDMessage(84489)
            printOHSAnswer(msg)

        #### Analyze Incident Subject ####
        msgID = aggHeaders[self.aggType]
        msg = ARCPY.GetIDMessage(msgID)
        ARCPY.SetProgressor("default", msg)
        printOHSSubject(msgID, addNewLine = False)

        #### Errors and Warnings ####
        y = self.analysisSSDO.fields[self.varName].returnDouble()
        yVar = NUM.var(y)
        if self.analysisSSDO.numObs < 30:
            #### Too Few Aggregated Features ####
            if self.boundaryFC:
                ARCPY.AddIDMessage("ERROR", 1573)
            else:
                ARCPY.AddIDMessage("ERROR", 1572)
            self.cleanUp()
            raise SystemExit()

        #### Zero Variance ####
        if NUM.isnan(yVar) or yVar <= 0.0:
            if self.aggType == 2:
                ARCPY.AddIDMessage("ERROR", 1534)
                self.cleanUp()
                raise SystemExit()
            else:
                ARCPY.AddIDMessage("ERROR", 1533)
                self.cleanUp()
                raise SystemExit()

        #### Count Description ####
        if self.aggType:
            msgID = 84490
        else:
            msgID = 84447
        msg = ARCPY.GetIDMessage(msgID).format(len(y))
        printOHSAnswer(msg, addNewLine = False)
        varNameCounts = ARCPY.GetIDMessage(84488)
        msg = ARCPY.GetIDMessage(84446).format(varNameCounts)
        printOHSAnswer(msg, addNewLine = False)
        printWeightAnswer(y)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:68,代码来源:OptimizedHotSpotAnalysis.py


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