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


Python SSUtilities.getNumericParameter方法代码示例

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


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

示例1: setupParameters

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getNumericParameter [as 别名]
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,代码行数:31,代码来源:DistWeightsCreator.py

示例2: setupKFunction

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

    inputFC = ARCPY.GetParameterAsText(0)
    outputTable = ARCPY.GetParameterAsText(1)
    nIncrements = ARCPY.GetParameter(2)
    permutations = ARCPY.GetParameterAsText(3).upper().replace(" ", "_")
    displayIt = ARCPY.GetParameter(4)                   
    weightField = UTILS.getTextParameter(5, fieldName = True)            
    begDist = UTILS.getNumericParameter(6)               
    dIncrement = UTILS.getNumericParameter(7)              
    edgeCorrection = ARCPY.GetParameterAsText(8).upper().replace(" ", "_")              
    studyAreaMethod = ARCPY.GetParameterAsText(9).upper().replace(" ", "_")             
    studyAreaFC = UTILS.getTextParameter(10)                

    #### Resolve Table Extension ####
    if ".dbf" not in OS.path.basename(outputTable):
        dirInfo = ARCPY.Describe(OS.path.dirname(outputTable))
        if dirInfo == "FileSystem":
            outputTable = outputTable + ".dbf"
    
    #### Resolve Remaining Parameters ####
    if nIncrements > 100:
        nIncrements = 100

    if edgeCorrection == "NONE" or edgeCorrection == "#": 
        edgeCorrection = None
    elif edgeCorrection == "SIMULATE_OUTER_BOUNDARY_VALUES": 
        edgeCorrection = "Simulate"
    elif edgeCorrection == "REDUCE_ANALYSIS_AREA": 
        edgeCorrection = "Reduce"
    else: 
        edgeCorrection = "Ripley"
   
    if permutations == "0_PERMUTATIONS_-_NO_CONFIDENCE_ENVELOPE":
        permutations = 0
    elif permutations == "99_PERMUTATIONS": 
        permutations = 99
    elif permutations == "999_PERMUTATIONS": 
        permutations = 999
    else: 
        permutations = 9

    if studyAreaMethod == "USER_PROVIDED_STUDY_AREA_FEATURE_CLASS":
        studyAreaMethod = 1
    else:
        studyAreaMethod = 0

    k = KFunction(inputFC, outputTable = outputTable,
                  nIncrements = nIncrements, permutations = permutations,
                  weightField = weightField, begDist = begDist, 
                  dIncrement = dIncrement, edgeCorrection = edgeCorrection,
                  studyAreaMethod = studyAreaMethod, studyAreaFC = studyAreaFC)

    k.report()
    k.createOutput(outputTable, displayIt = displayIt)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:59,代码来源:KFunction.py

示例3: setupNearestNeighbor

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

    inputFC = ARCPY.GetParameterAsText(0)
    distanceConcept = ARCPY.GetParameterAsText(1).upper().replace(" ", "_")
    displayIt = ARCPY.GetParameter(2)                   
    studyArea = UTILS.getNumericParameter(3)                  
    concept = WU.conceptDispatch[distanceConcept]

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

    #### Populate SSDO with Data ####
    ssdo.obtainDataGA(ssdo.oidName, minNumObs = 2)

    #### Calculate ####
    nn = NearestNeighbor(ssdo, concept = concept, studyArea = studyArea)

    #### Report and Set Parameters ####
    nn.report()

    try:
        ARCPY.SetParameterAsText(4, nn.ratioString)
        ARCPY.SetParameterAsText(5, nn.znString)
        ARCPY.SetParameterAsText(6, nn.pvString)
        ARCPY.SetParameterAsText(7, nn.enString)
        ARCPY.SetParameterAsText(8, nn.nnString)
    except:
        ARCPY.AddIDMessage("WARNING", 902)

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

示例4: setupParameters

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getNumericParameter [as 别名]
def setupParameters():
    """ Setup Parameters for Kernel-based Weights Creation """
    inputFC = ARCPY.GetParameterAsText(0)
    outputFile = ARCPY.GetParameterAsText(1)
    kernelType = ARCPY.GetParameterAsText(2).upper()
    neighborNum = UTILS.getNumericParameter(3)
    idField = UTILS.getTextParameter(4)

    if kernelType not in KERNELTYPE:
        ARCPY.AddError("Kernel type is not in the predefined list...")
        raise SystemExit()

    #### Run Kernel Weights Creation ####
    kernW = KernelW_PySAL(inputFC, outputFile, kernelType, neighborNum, idField)
    
    #### Create Output ####
    kernW.createOutput()
开发者ID:Esri,项目名称:PySAL-ArcGIS-Toolbox,代码行数:19,代码来源:KernelWeightsCreator.py

示例5: setupParameters

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getNumericParameter [as 别名]
def setupParameters():
    
    #### Get User Provided Inputs ####
    inputFC = ARCPY.GetParameterAsText(0) 
    outputFile = ARCPY.GetParameterAsText(1)
    idField = UTILS.getTextParameter(2)
    weightType = UTILS.getTextParameter(3).upper() 
    weightOrder = UTILS.getNumericParameter(4)
    isLowOrder = ARCPY.GetParameter(5)
    
    #### Validate Input of WeightType ####
    if not weightType or weightType not in WEIGHTTYPE:
        ARCPY.AddError("Weights type can only be Rook or Queen...")
        raise SystemExit()

    #### Run Cont Weights Creation ####
    contW = ContW_PySAL(inputFC, outputFile, idField, weightType, weightOrder, \
                        isLowOrder)
    
    #### Create Output ####
    contW.createOutput()
开发者ID:gdherbert,项目名称:PySAL-ArcGIS-Toolbox,代码行数:23,代码来源:ContWeightsCreator.py

示例6: setupGlobalI_Increment

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getNumericParameter [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: setupWeights

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

    inputFC = ARCPY.GetParameterAsText(0)      
    masterField = ARCPY.GetParameterAsText(1)
    swmFile = ARCPY.GetParameterAsText(2)
    spaceConcept = ARCPY.GetParameterAsText(3)
    distanceConcept = ARCPY.GetParameterAsText(4)
    exponent = UTILS.getNumericParameter(5)
    threshold = UTILS.getNumericParameter(6)
    kNeighs = UTILS.getNumericParameter(7)
    rowStandard = ARCPY.GetParameter(8)
    tableFile = ARCPY.GetParameterAsText(9)

    #### Assess Temporal Options ####'
    timeField = UTILS.getTextParameter(10, fieldName = True)
    timeType = UTILS.getTextParameter(11)
    timeValue = UTILS.getNumericParameter(12)

    #### Assign to appropriate spatial weights method ####
    try:
        wType = WU.weightDispatch[spaceConcept]
    except:
        ARCPY.AddIDMessage("Error", 723)
        raise SystemExit()

    #### EUCLIDEAN or MANHATTAN ####
    concept = WU.conceptDispatch[distanceConcept]
    if not kNeighs:
        kNeighs = 0

    if wType <= 1:
        #### Distance Based Weights ####
        ARCPY.AddMessage(ARCPY.GetIDMessage(84118))

        #### Set Options for Fixed vs. Inverse ####
        if wType == 0:        
            exponent = exponent
            fixed = 0
        else:
            exponent = 1
            fixed = 1
        
        #### Execute Distance-Based Weights ####
        w = distance2SWM(inputFC, swmFile, masterField, fixed = fixed, 
                         concept = concept, exponent = exponent, 
                         threshold = threshold, kNeighs = kNeighs, 
                         rowStandard = rowStandard)

    elif wType == 2:
        #### k-Nearest Neighbors Weights ####
        ARCPY.AddMessage(ARCPY.GetIDMessage(84119))
        w = kNearest2SWM(inputFC, swmFile, masterField, concept = concept,
                         kNeighs = kNeighs, rowStandard = rowStandard)

    elif wType == 3:
        #### Delaunay Triangulation Weights ####
        ARCPY.AddMessage(ARCPY.GetIDMessage(84120))
        w = delaunay2SWM(inputFC, swmFile, masterField, 
                         rowStandard = rowStandard)

    elif wType == 4:
        #### Contiguity Based Weights, Edges Only ####
        ARCPY.AddMessage(ARCPY.GetIDMessage(84121))
        w = polygon2SWM(inputFC, swmFile, masterField, concept = concept, 
                        kNeighs = kNeighs, rowStandard = rowStandard,
                        contiguityType = "ROOK")

    elif wType == 5:
        #### Contiguity Based Weights, Edges and Corners ####
        ARCPY.AddMessage(ARCPY.GetIDMessage(84122))
        w = polygon2SWM(inputFC, swmFile, masterField, concept = concept, 
                        kNeighs = kNeighs, rowStandard = rowStandard,
                        contiguityType = "QUEEN")

    elif wType == 9:
        ARCPY.AddMessage(ARCPY.GetIDMessage(84255))
        w = spaceTime2SWM(inputFC, swmFile, masterField, concept = concept,
                          threshold = threshold, rowStandard = rowStandard,
                          timeField = timeField, timeType = timeType,
                          timeValue = timeValue)

    else:
        #### Tabular Input for Weights ####
        ARCPY.AddMessage(ARCPY.GetIDMessage(84123))
        if tableFile == "" or tableFile == "#":
            ARCPY.AddIDMessage("Error", 721)
            raise SystemExit()
        else: 
            table2SWM(inputFC, masterField, swmFile, tableFile, 
                      rowStandard = rowStandard) 
开发者ID:leochin,项目名称:GSWMtest,代码行数:94,代码来源:Weights.py

示例8: setupLocalI

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getNumericParameter [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

示例9: setupGlobalI

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getNumericParameter [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

示例10: runExploratoryRegression

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getNumericParameter [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

示例11: setupLocalG

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getNumericParameter [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

示例12: setupNetwork2SWM

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

    #### Process Dialogue Inputs ####
    inputFC = ARCPY.GetParameterAsText(0)      
    masterField = ARCPY.GetParameterAsText(1)
    swmFile = ARCPY.GetParameterAsText(2)
    inputNetwork = ARCPY.GetParameterAsText(3)
    impedance = ARCPY.GetParameterAsText(4)

    cutoff = UTILS.getNumericParameter(5)
    if not cutoff:
        cutoff = "#"

    numberOfNeighs = UTILS.getNumericParameter(6)
    if not numberOfNeighs:
        numberOfNeighs = "#"

    inputBarrier = UTILS.getTextParameter(7)
    if not inputBarrier:
        inputBarrier = "#"

    uturnPolicy = ARCPY.GetParameterAsText(8)

    restrictions = UTILS.getTextParameter(9)
    if not restrictions:
        restrictions = "#"

    hierarchyBool = ARCPY.GetParameter(10)
    if hierarchyBool:
        hierarchy = 'USE_HIERARCHY'
    else:
        hierarchy = 'NO_HIERARCHY'

    searchTolerance = UTILS.getTextParameter(11)
    if not searchTolerance:
        searchTolerance = "#"

    #### Assign to appropriate spatial weights method ####
    spaceConcept = ARCPY.GetParameterAsText(12)
    spaceConcept = spaceConcept + "_DISTANCE"
    try:
        wType = WU.weightDispatch[spaceConcept]
    except:
        ARCPY.AddIDMessage("Error", 723)
        raise SystemExit()

    #### Must Be Inverse Distance [0] or Fixed Distance [1] ####
    if wType not in [0,1]:
        ARCPY.AddIDMessage("Error", 723)
        raise SystemExit()
    else:
        fixed = wType

    exponent = UTILS.getNumericParameter(13)
    rowStandard = ARCPY.GetParameter(14)

    network2SWM(inputFC, masterField, swmFile, inputNetwork, impedance, 
                cutoff = cutoff, numberOfNeighs = numberOfNeighs,
                inputBarrier = inputBarrier, uturnPolicy = uturnPolicy, 
                restrictions = restrictions, hierarchy = hierarchy, 
                searchTolerance = searchTolerance, fixed = fixed, 
                exponent = exponent, rowStandard = rowStandard)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:66,代码来源:Network2SWM.py

示例13: setupSimilarity

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

    inputFC = ARCPY.GetParameterAsText(0)                    
    candidateFC = ARCPY.GetParameterAsText(1)
    outputFC = ARCPY.GetParameterAsText(2)
    collapseToPoints = ARCPY.GetParameter(3)
    similarType = ARCPY.GetParameterAsText(4)
    matchMethod = ARCPY.GetParameterAsText(5)
    numResults = UTILS.getNumericParameter(6)
    tempFieldNames = ARCPY.GetParameterAsText(7).upper()   
    tempFieldNames = tempFieldNames.split(";")
    appendFields = ARCPY.GetParameterAsText(8).upper()   
    if appendFields != "":
        appendFields = appendFields.split(";")
        appendFields = [ i for i in appendFields if i not in tempFieldNames ]
    else:
        appendFields = []

    #### Field Validation ####
    ssdoBase = SSDO.SSDataObject(inputFC, useChordal = False)
    ssdoCand = SSDO.SSDataObject(candidateFC, 
                                 explicitSpatialRef = ssdoBase.spatialRef,
                                 useChordal = False)

    fieldNames, appendBase, badInputNames = fieldValidation(ssdoBase, 
                                                            ssdoCand, 
                                                            tempFieldNames, 
                                                            appendFields)

    #### Warn About Excluded Fields #### 
    badNames = len(badInputNames)
    if badNames:
        badInputNames = ", ".join(badInputNames)
        ARCPY.AddIDMessage("WARNING", 1584, badInputNames)

    #### No Valid Fields Found ####
    if not len(fieldNames):
        ARCPY.AddIDMessage("ERROR", 1585)
        raise SystemExit()

    #### Runtime Check for Cosign Sim (In Class as Well for Variance) ####
    if len(fieldNames) == 1 and matchMethod == 'ATTRIBUTE_PROFILES':
        ARCPY.AddIDMessage("ERROR", 1597)
        raise SystemExit()

    allFieldNamesBase = fieldNames + appendBase
    allFieldNamesCand = fieldNames + appendFields

    ssdoBase.obtainData(ssdoBase.oidName, allFieldNamesBase,
                        dateStr = True, explicitBadRecordID = 1615)
    if ssdoBase.numObs == 0:
        ARCPY.AddIDMessage("ERROR", 1599)
        raise SystemExit()

    ssdoCand.obtainData(ssdoCand.oidName, allFieldNamesCand, 
                        dateStr = True, explicitBadRecordID = 1616)
    if ssdoCand.numObs <= 2:
        ARCPY.AddIDMessage("ERROR", 1589)
        raise SystemExit()

    ss = SimilaritySearch(ssdoBase, ssdoCand, fieldNames,
                          similarType = similarType,
                          matchMethod = matchMethod,
                          numResults = numResults,
                          appendFields = allFieldNamesCand)
    ss.report()

    baseIsPoint = UTILS.renderType[ssdoBase.shapeType.upper()] == 0
    baseCandDiff = ssdoBase.shapeType.upper() != ssdoCand.shapeType.upper()
    if collapseToPoints or baseIsPoint or baseCandDiff:
        ss.createOutput(outputFC)
    else:
        ss.createOutputShapes(outputFC)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:77,代码来源:Similarity.py


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