def setupParameters(): #### Get User Provided Inputs #### inputFC = ARCPY.GetParameterAsText(0) depVarName = ARCPY.GetParameterAsText(1).upper() indVarNames = ARCPY.GetParameterAsText(2).upper() indVarNames = indVarNames.split(";") weightsFile = ARCPY.GetParameterAsText(3) kernelWeightsFile = ARCPY.GetParameterAsText(4) pValue = ARCPY.GetParameter(5) useCombo = ARCPY.GetParameter(6) outputFC = ARCPY.GetParameterAsText(7) #### Create SSDataObject #### fieldList = [depVarName] + indVarNames ssdo = SSDO.SSDataObject(inputFC, templateFC=outputFC) #### Setup masterField for ssdo from Model weights file #### masterField1 = AUTILS.setUniqueIDField(ssdo, weightsFile) if masterField1 == None: ARCPY.AddError("The Model weights file format is not valid.") raise SystemExit() #### Setup masterField for ssdo from Kernel weights file #### masterField2 = None wType = kernelWeightsFile[-3:].lower() if wType == "kwt" or wType == "swm": masterField2 = AUTILS.setUniqueIDField(ssdo, kernelWeightsFile) if masterField2 == None: ARCPY.AddError("The Kernel weights file format is not valid.") raise SystemExit() #### Detect if Two Weights Files Are Matched (Same Unique Field) #### if masterField1 != masterField2: ARCPY.AddError("The Model weights file and Kernel weights file have " "different unique ID fields.") raise SystemExit() #### Populate SSDO with Data #### ssdo.obtainData(masterField1, fieldList) #### Resolve Weights File #### patW = None patKW = None try: patW = AUTILS.PAT_W(ssdo, weightsFile) patKW = AUTILS.PAT_W(ssdo, kernelWeightsFile) except: ARCPY.AddError("There is an error occurred when read weights files.") raise SystemExit() #### Run AutoSpace #### auto = AutoSpace_PySAL(ssdo, depVarName, indVarNames, patW, patKW, pValue, useCombo) #### Create Output #### auto.createOutput(outputFC)
def setupParameters(): #### Get User Provided Inputs #### inputFC = ARCPY.GetParameterAsText(0) depVarName = ARCPY.GetParameterAsText(1).upper() indVarNames = ARCPY.GetParameterAsText(2).upper() indVarNames = indVarNames.split(";") weightsFile = ARCPY.GetParameterAsText(3) outputFC = ARCPY.GetParameterAsText(4) useHAC = ARCPY.GetParameter(5) #### Create SSDataObject #### fieldList = [depVarName] + indVarNames ssdo = SSDO.SSDataObject(inputFC, templateFC=outputFC) masterField = AUTILS.setUniqueIDField(ssdo, weightsFile) #### Populate SSDO with Data #### ssdo.obtainData(masterField, fieldList) #### Resolve Weights File #### patW = AUTILS.PAT_W(ssdo, weightsFile) #### Run OLS #### ols = GMError_PySAL(ssdo, depVarName, indVarNames, patW, useHAC=useHAC) #### Create Output #### ols.createOutput(outputFC)
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)