本文整理汇总了Python中SSUtilities.getTextParameter方法的典型用法代码示例。如果您正苦于以下问题:Python SSUtilities.getTextParameter方法的具体用法?Python SSUtilities.getTextParameter怎么用?Python SSUtilities.getTextParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SSUtilities
的用法示例。
在下文中一共展示了SSUtilities.getTextParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupMedianCenter
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getTextParameter [as 别名]
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)
示例2: setupParameters
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getTextParameter [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()
示例3: setupStandardDistance
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getTextParameter [as 别名]
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)
示例4: setupParameters
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getTextParameter [as 别名]
def setupParameters():
#### Get User Provided Inputs ####
inputFC = ARCPY.GetParameterAsText(0)
depVarName = ARCPY.GetParameterAsText(1).upper()
indVarNames = ARCPY.GetParameterAsText(2).upper()
indVarNames = indVarNames.split(";")
outputFC = UTILS.getTextParameter(3)
weightsFile = UTILS.getTextParameter(4)
#### Create SSDataObject ####
fieldList = [depVarName] + indVarNames
ssdo = SSDO.SSDataObject(inputFC, templateFC = outputFC)
masterField = AUTILS.setUniqueIDField(ssdo, weightsFile = weightsFile)
#### Populate SSDO with Data ####
ssdo.obtainData(masterField, fieldList, minNumObs = 5)
#### Resolve Weights File ####
if weightsFile:
patW = AUTILS.PAT_W(ssdo, weightsFile)
else:
patW = None
#### Run OLS ####
ols = OLS_PySAL(ssdo, depVarName, indVarNames, patW = patW)
#### Create Output ####
ols.createOutput(outputFC)
示例5: setupKFunction
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getTextParameter [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)
示例6: setupParameters
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getTextParameter [as 别名]
def setupParameters():
""" Setup Parameters for Weights Convertion """
#### Get User Provided Inputs ####
inputFile = UTILS.getTextParameter(0)
outputFile = UTILS.getTextParameter(1)
inputFC = ARCPY.GetParameterAsText(2)
inputIDField = UTILS.getTextParameter(3)
#### Raise Error If Input Weights File is Not Valid ####
inputExt = AUTILS.returnWeightFileType(inputFile)
if inputExt.upper() not in EXTENSIONS:
msg = ("Input spatial weights file not supported! Please only use GAL, "
"GWT, KWT and SWM files...")
ARCPY.AddError(msg)
raise SystemExit()
#### Raise Error If Output Weights File is Not Valid ####
outputExt = AUTILS.returnWeightFileType(outputFile)
if outputExt.upper() not in EXTENSIONS:
msg = ("Output spatial weights file not supported! Please only use "
"GAL, GWT, KWT and SWM files...")
ARCPY.AddError(msg)
raise SystemExit()
#### Raise Error If Input Weights File is Empty ####
if not os.path.isfile(inputFile) or os.path.getsize(inputFile) == 0:
msg = ("Input spaital weights file is empty! Please use a valid "
"weights file")
ARCPY.AddError(msg)
raise SystemExit()
#### Copy if convert to same file formats ####
if not inputFC and not inputIDField and inputExt == outputExt:
from shutil import copyfile
copyfile(inputFile, outputFile)
return
#### Run Weights Convertor ####
wConvertor = WeightConvertor(inputFile, outputFile, inputFC, inputIDField,\
inputExt, outputExt)
#### Create New Weights File ####
wConvertor.createOutput()
示例7: setupOptHotSpot
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getTextParameter [as 别名]
def setupOptHotSpot():
"""Retrieves the parameters from the User Interface and executes the
appropriate commands."""
#### Input Parameters ####
inputFC = ARCPY.GetParameterAsText(0)
outputFC = ARCPY.GetParameterAsText(1)
varName = UTILS.getTextParameter(2, fieldName = True)
aggMethod = UTILS.getTextParameter(3)
if aggMethod:
aggType = aggTypes[aggMethod.upper()]
else:
aggType = 1
boundaryFC = UTILS.getTextParameter(4)
polygonFC = UTILS.getTextParameter(5)
outputRaster = UTILS.getTextParameter(6)
makeFeatureLayerNoExtent = UTILS.clearExtent(DM.MakeFeatureLayer)
selectLocationNoExtent = UTILS.clearExtent(DM.SelectLayerByLocation)
featureLayer = "InputOHSA_FC"
makeFeatureLayerNoExtent(inputFC, featureLayer)
if boundaryFC:
selectLocationNoExtent(featureLayer, "INTERSECT",
boundaryFC, "#",
"NEW_SELECTION")
polygonFC = None
if polygonFC:
selectLocationNoExtent(featureLayer, "INTERSECT",
polygonFC, "#",
"NEW_SELECTION")
boundaryFC = None
#### Create SSDO ####
ssdo = SSDO.SSDataObject(featureLayer, templateFC = outputFC,
useChordal = True)
hs = OptHotSpots(ssdo, outputFC, varName = varName, aggType = aggType,
polygonFC = polygonFC, boundaryFC = boundaryFC,
outputRaster = outputRaster)
DM.Delete(featureLayer)
示例8: setupParameters
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getTextParameter [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()
示例9: setupCentralFeature
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getTextParameter [as 别名]
def setupCentralFeature():
"""Retrieves the parameters from the User Interface and executes the
appropriate commands."""
inputFC = ARCPY.GetParameterAsText(0)
outputFC = ARCPY.GetParameterAsText(1)
distanceMethod = ARCPY.GetParameterAsText(2).upper().replace(" ", "_")
weightField = UTILS.getTextParameter(3, fieldName = True)
potentialField = UTILS.getTextParameter(4, fieldName = True)
caseField = UTILS.getTextParameter(5, fieldName = True)
distanceMethod = distanceMethod.split("_")[0]
fieldList = []
if weightField:
fieldList.append(weightField)
if potentialField:
fieldList.append(potentialField)
if caseField:
fieldList.append(caseField)
#### 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 = 1, dateStr = True)
#### Run Analysis ####
cf = CentralFeature(ssdo, distanceMethod = distanceMethod,
weightField = weightField,
potentialField = potentialField,
caseField = caseField)
#### Create Output ####
cf.createOutput(outputFC)
示例10: setupParameters
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getTextParameter [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()
示例11: runExploratoryRegression
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getTextParameter [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)
示例12: setupGlobalI_Increment
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getTextParameter [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)
示例13: setupWeights
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getTextParameter [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)
示例14: setupLocalI
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getTextParameter [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()
示例15: setupGlobalI
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getTextParameter [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)