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


Python SSUtilities.getFieldNames方法代码示例

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


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

示例1: createCoefficientTable

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

示例2: outputResults

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getFieldNames [as 别名]
    def outputResults(self):
        """Creates output feature class Local Gi*."""

        #### Prepare Derived Variables for Output Feature Class ####
        outPath, outName = OS.path.split(self.outputFC)
        fieldOrder = UTILS.getFieldNames(giFieldNames, outPath)
        fieldData = [self.gi, self.pVals]
        fieldTypes = ["DOUBLE", "DOUBLE"]

        #### Add Pseudo-P Field ####
        if self.permutations:
            fieldOrder.append(giPseudoFieldName)
            fieldData.append(self.pseudoPVals)
            fieldTypes.append("DOUBLE")

        #### Add Gi Bin Field ####
        fieldOrder.append(giBinFieldName)
        fieldData.append(self.giBins)
        fieldTypes.append("LONG")

        #### Create Alias Field Names ####
        rowStandard = False
        if self.wType == 8:
            addString = OS.path.basename(self.weightsFile)
        elif self.wType in [0, 1, 7]:
            if self.maxSet:
                addString = "0"
            else:
                addString = str(int(self.threshold))
        else:
            addString = None

        aliasList = WU.createSpatialFieldAliases(
            fieldOrder, addString=addString, wType=self.wType, exponent=self.exponent, rowStandard=rowStandard
        )
        if self.applyFDR:
            aliasList[-1] += "_FDR"

        #### Create/Populate Dictionary of Candidate Fields ####
        candidateFields = {}
        for fieldInd, fieldName in enumerate(fieldOrder):
            fieldType = fieldTypes[fieldInd]
            candidateField = SSDO.CandidateField(fieldName, fieldType, fieldData[fieldInd], alias=aliasList[fieldInd])
            candidateFields[fieldName] = candidateField

        #### Input Fields to Copy to Output FC ####
        appendFields = [i for i in self.fieldNames]

        #### Add Date-Time Field If Applicable ####
        if self.swmFileBool:
            if self.swm.wType == 9:
                if self.ssdo.allFields.has_key(self.swm.timeField.upper()):
                    appendFields.insert(0, self.swm.timeField.upper())

        #### Write Data to Output Feature Class ####
        self.ssdo.output2NewFC(self.outputFC, candidateFields, appendFields=appendFields, fieldOrder=fieldOrder)

        return fieldOrder[0], fieldOrder[1]
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:60,代码来源:Gi.py

示例3: outputResults

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getFieldNames [as 别名]
    def outputResults(self, outputFC):
        """Creates output feature class."""

        #### Shorthand Attributes ####
        ssdo = self.ssdo

        #### Prepare Derived Variables for Output Feature Class ####
        outPath, outName = OS.path.split(outputFC)
        resultDict = {}
        fieldOrder = UTILS.getFieldNames(olsFCFieldNames, outPath)
        fieldData = [self.yHat.flatten(), self.residuals.flatten(),
                     self.stdRedisuals.flatten()]

        #### Create/Populate Dictionary of Candidate Fields ####
        candidateFields = {}
        for fieldInd, fieldName in enumerate(fieldOrder):
            candidateField = SSDO.CandidateField(fieldName, "DOUBLE",
                                                 fieldData[fieldInd])
            candidateFields[fieldName] = candidateField

        #### Write Data to Output Feature Class ####
        ssdo.output2NewFC(outputFC, candidateFields,
                          appendFields = self.allVars,
                          fieldOrder = fieldOrder)

        #### Set Default Symbology ####
        params = ARCPY.gp.GetParameterInfo()
        try:
            renderType = UTILS.renderType[ssdo.shapeType.upper()]
            if renderType == 0:
                renderLayerFile = "StdResidPoints.lyr"
            elif renderType == 1:
                renderLayerFile = "StdResidPolylines.lyr"
            else:
                renderLayerFile = "StdResidPolygons.lyr"
            templateDir = OS.path.dirname(OS.path.dirname(SYS.argv[0]))
            fullRLF = OS.path.join(templateDir, "Templates",
                                   "Layers", renderLayerFile)
            params[2].Symbology = fullRLF
        except:
            ARCPY.AddIDMessage("WARNING", 973)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:43,代码来源:OLS.py

示例4: createDiagnosticTable

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getFieldNames [as 别名]
    def createDiagnosticTable(self, tableName):
        """Creates Output Diagnostic Database Table for OLS.

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

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

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

        #### Set Up Input Data ####
        inputData = []
        diags = [84114, 84249, 84018, 84021, 84024, 84027, 84030,
                 84033, 84036, 84039, 84042, 84045, 84062]

        desc = [84116, 84250, 84020, 84023, 84026, 84029, 84032,
                84035, 84038, 84041, 84044, 84047, 84063]

        diags = [ ARCPY.GetIDMessage(i) for i in diags ]
        desc = [ ARCPY.GetIDMessage(i) for i in desc ]

        stats = [self.aic, self.aicc, self.r2, self.r2Adj,
                 self.fStat, self.fProb, self.waldStat, self.waldProb,
                 self.BP, self.BPProb, self.JB, self.JBProb, self.s2]

        for rowInd, rowVal in enumerate(stats):
            inputData.append( (diags[rowInd], rowVal, desc[rowInd]) )

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

示例5: createOutput

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getFieldNames [as 别名]
    def createOutput(self, outputFC):
        """Creates an Output Feature Class with the Median Centers.

        INPUTS:
        outputFC (str): path to the output feature class
        """

        #### Validate Output Workspace ####
        ERROR.checkOutputPath(outputFC)

        #### Shorthand Attributes ####
        ssdo = self.ssdo
        caseField = self.caseField
        attFields = self.attFields

        #### Create Output Feature Class ####
        ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84003))
        outPath, outName = OS.path.split(outputFC)

        try:
            DM.CreateFeatureclass(outPath, outName, "POINT", "", ssdo.mFlag, 
                                  ssdo.zFlag, ssdo.spatialRefString)
        except:
            ARCPY.AddIDMessage("ERROR", 210, outputFC)
            raise SystemExit()

        #### Add Field Names ####
        dataFieldNames = UTILS.getFieldNames(mdcFieldNames, outPath)
        shapeFieldNames = ["[email protected]"]
        for fieldName in dataFieldNames:
            UTILS.addEmptyField(outputFC, fieldName, "DOUBLE")

        caseIsDate = False
        if caseField:
            fcCaseField = ssdo.allFields[caseField]
            validCaseName = UTILS.validQFieldName(fcCaseField, outPath)
            caseType = UTILS.convertType[fcCaseField.type]
            UTILS.addEmptyField(outputFC, validCaseName, caseType)
            dataFieldNames.append(validCaseName)
            if caseType.upper() == "DATE":
                caseIsDate = True

        if attFields:
            for attField in attFields:
                fcAttField = ssdo.allFields[attField]
                validAttName = UTILS.validQFieldName(fcAttField, outPath)
                if caseField:
                    if validCaseName == validAttName:
                        validAttName = ARCPY.GetIDMessage(84195)
                UTILS.addEmptyField(outputFC, validAttName, "DOUBLE") 
                dataFieldNames.append(validAttName)

        outShapeFileBool = UTILS.isShapeFile(outputFC)
            
        #### Add Median X, Y, Dim ####
        allFieldNames = shapeFieldNames + dataFieldNames
        rows = DA.InsertCursor(outputFC, allFieldNames)
        for case in self.caseKeys:

            #### Median Centers ####
            medX, medY = self.medianCenter[case]
            pnt = (medX, medY, ssdo.defaultZ)
            rowResult = [pnt, medX, medY]

            #### Set Attribute Fields ####
            if caseField:
                caseValue = case.item()
                if caseIsDate:
                    caseValue = TUTILS.iso2DateTime(caseValue)
                rowResult.append(caseValue)

            #### Set Attribute Fields ####
            if attFields:
                for attInd, attField in enumerate(self.attFields):
                    medAtt = self.attCenter[case][attInd]
                    rowResult.append(medAtt)

            rows.insertRow(rowResult)
        
        #### Clean Up ####
        del rows

        #### Set Attribute ####
        self.outputFC = outputFC
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:86,代码来源:MedianCenter.py

示例6: createOutput

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getFieldNames [as 别名]
    def createOutput(self, outputFC):
        """Creates an Output Feature Class with the Standard Distances.

        INPUTS:
        outputFC (str): path to the output feature class
        """

        #### Validate Output Workspace ####
        ERROR.checkOutputPath(outputFC)

        #### Shorthand Attributes ####
        ssdo = self.ssdo
        caseField = self.caseField

        #### Increase Extent if not Projected ####
        if ssdo.spatialRefType != "Projected":
            sdValues = self.sd.values()
            if len(sdValues):
                maxRadius = max(sdValues)
                largerExtent = UTILS.increaseExtentByConstant(ssdo.extent, 
                                                    constant = maxRadius)
                largerExtent = [ LOCALE.str(i) for i in largerExtent ]
                ARCPY.env.XYDomain = " ".join(largerExtent)

        #### Create Output Feature Class ####
        ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84003))
        outPath, outName = OS.path.split(outputFC)

        try:
            DM.CreateFeatureclass(outPath, outName, "POLYGON", 
                                  "", ssdo.mFlag, ssdo.zFlag, 
                                  ssdo.spatialRefString)
        except:
            ARCPY.AddIDMessage("ERROR", 210, outputFC)
            raise SystemExit()

        #### Add Fields to Output FC ####
        dataFieldNames = UTILS.getFieldNames(sdFieldNames, outPath)
        shapeFieldNames = ["[email protected]"]
        for fieldName in dataFieldNames:
            UTILS.addEmptyField(outputFC, fieldName, "DOUBLE")

        caseIsDate = False
        if caseField:
            fcCaseField = ssdo.allFields[caseField]
            validCaseName = UTILS.validQFieldName(fcCaseField, outPath)
            caseType = UTILS.convertType[fcCaseField.type]
            UTILS.addEmptyField(outputFC, validCaseName, caseType)
            dataFieldNames.append(validCaseName)
            if caseType.upper() == "DATE":
                caseIsDate = True

        #### Write Output ####
        badCaseRadians = []
        allFieldNames = shapeFieldNames + dataFieldNames
        rows = DA.InsertCursor(outputFC, allFieldNames)
        for case in self.caseKeys:

            #### Get Results ####
            xVal, yVal = self.meanCenter[case]
            radius = self.sd[case]

            #### Create Empty Polygon Geomretry ####
            poly = ARCPY.Array()

            #### Check for Valid Radius ####
            radiusZero = UTILS.compareFloat(0.0, radius, rTol = .0000001)
            radiusNan = NUM.isnan(radius)
            radiusBool = radiusZero + radiusNan
            if radiusBool:
                badRadian = 6
                badCase = UTILS.caseValue2Print(case, self.caseIsString)
                badCaseRadians.append(badCase)
            else:
                badRadian = 0

                #### Calculate a Point For Each ####
                #### Degree in Circle Polygon ####
                for degree in NUM.arange(0, 360):  
                    try:
                        radians = NUM.pi / 180.0 * degree
                        pntX = xVal + (radius * NUM.cos(radians))
                        pntY = yVal + (radius * NUM.sin(radians))
                        pnt = ARCPY.Point(pntX, pntY, ssdo.defaultZ)
                        poly.add(pnt)
                    except:
                        badRadian += 1
                        if badRadian == 6:
                            badCase = UTILS.caseValue2Print(case, 
                                               self.caseIsString)
                            badCaseRadians.append(badCase)
                            break

            if badRadian < 6:
                #### Create and Populate New Feature ####
                poly = ARCPY.Polygon(poly, None, True)
                rowResult = [poly, xVal, yVal, radius]

                if caseField:
                    caseValue = case.item()
#.........这里部分代码省略.........
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:103,代码来源:StandardDistance.py

示例7: outputResults

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getFieldNames [as 别名]
    def outputResults(self):
        """Creates output feature class for Local I."""

        #### Prepare Derived Variables for Output Feature Class ####
        outPath, outName = OS.path.split(self.outputFC)
        fieldOrder = UTILS.getFieldNames(liFieldNames, outPath)
        fieldData = [self.li, self.zi, self.pVals]

        #### Add Pseudo-P Field ####
        if self.permutations:
            fieldOrder.append(liPseudoFieldName)
            fieldData.append(self.pseudoPVals)

        #### Add CO Type Field ####
        fieldOrder.append(liCOFieldName)
        whereNull = NUM.where(self.pVals == NUM.nan)[0]
        if len(whereNull):
            outBins = list(self.moranBins)
            for ind in whereNull:
                outBins[ind] = NUM.nan
            fieldData.append(outBins)
        else:
            fieldData.append(self.moranBins)

        #### Create Alias Field Names ####
        if self.wType == 8:
            addString = OS.path.basename(self.weightsFile)
            rowStandard = False
        elif self.wType in [0, 1, 7]:
            if self.maxSet:
                addString = "0"
            else:
                addString = str(int(self.threshold))
            rowStandard = self.rowStandard
        else:
            addString = None
            rowStandard = self.rowStandard

        aliasList = WU.createSpatialFieldAliases(fieldOrder, 
                                                 addString = addString, 
                                                 wType = self.wType, 
                                                 exponent = self.exponent,
                                                 rowStandard = rowStandard)
        if self.applyFDR:
            aliasList[-1] += "_FDR"

        #### Create/Populate Dictionary of Candidate Fields ####
        candidateFields = {}
        for fieldInd, fieldName in enumerate(fieldOrder):
            if fieldName == liCOFieldName:
                fType = "TEXT"
                length = 2
            else:
                fType = "DOUBLE"
                length = None
            candidateField = SSDO.CandidateField(fieldName, fType, 
                                                 fieldData[fieldInd],
                                                 alias = aliasList[fieldInd],
                                                 length = length)
            candidateFields[fieldName] = candidateField

        #### Input Fields to Copy to Output FC ####
        appendFields = [i for i in self.fieldNames]

        #### Add Date-Time Field If Applicable ####
        if self.swmFileBool:
            if self.swm.wType == 9:
                if self.ssdo.allFields.has_key(self.swm.timeField.upper()):
                    appendFields.insert(0, self.swm.timeField.upper())

        #### Write Data to Output Feature Class ####
        self.ssdo.output2NewFC(self.outputFC, candidateFields, 
                               appendFields = appendFields,
                               fieldOrder = fieldOrder)

        outFieldSet = fieldOrder[0:3] + [fieldOrder[-1]]
        return outFieldSet
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:79,代码来源:LocalMoran.py

示例8: exportXYV

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getFieldNames [as 别名]
def exportXYV(inputFC, fieldList, delimiter, outFile, outFieldNames=False):
    """Exports the X,Y Coords and Set of Field Values for a Given
    Feature Class.

    INPUTS:
    inputFC (str): path to the input feature class
    fieldList (list): list of field names to export
    delimiter (str): token to delimit output file with
    outFile (str): path to the output text file
    outFieldNames (bool): return field names in first row of text file?

    OUTPUT:
    outFile (file): output text file
    """

    #### Get Feature Class Properties ####
    ssdo = SSDO.SSDataObject(inputFC, useChordal=False)
    inputFields = [ssdo.oidName, "[email protected]"] + fieldList

    #### Create Progressor Bar ####
    cnt = UTILS.getCount(inputFC)
    ARCPY.AddMessage(ARCPY.GetIDMessage(84012))
    ARCPY.SetProgressor("step", ARCPY.GetIDMessage(84012), 0, cnt, 1)

    #### Keep track of Invalid Fields ####
    badIDs = []
    badRecord = 0

    #### Process Field Values ####
    try:
        rows = DA.SearchCursor(ssdo.inputFC, inputFields, "", ssdo.spatialRefString)
    except:
        ARCPY.AddIDMessage("ERROR", 204)
        raise SystemExit()

    #### Get Field Types and Set LOCALE Dictionary ####
    floatTypes = ["Single", "Double"]
    localeDict = {}
    for field in fieldList:
        fieldType = ssdo.allFields[field].type
        if fieldType in floatTypes:
            formatToken = "%f"
        else:
            formatToken = "%s"
        localeDict[field] = formatToken

    #### Create Output File ####
    fo = UTILS.openFile(outFile, "w")

    #### Write Field Names to File ####
    if outFieldNames:
        outPath, outName = OS.path.split(outFile)
        allFieldNames = UTILS.getFieldNames(exyvFieldNames, outPath)
        allFieldNames += fieldList
        outRow = delimiter.join(allFieldNames)
        fo.write("%s\n" % outRow.encode("utf-8"))

    for row in rows:
        OID = row[0]
        badValues = row.count(None)
        badXY = row[1].count(None)
        badRow = badValues or badXY
        if not badXY:
            xCoord, yCoord = row[1]
            x = LOCALE.format("%0.8f", xCoord)
            y = LOCALE.format("%0.8f", yCoord)
        else:
            x = "NULL"
            y = "NULL"

        #### Check to see whether field values are OK ####
        rowValues = [x, y]
        for ind, field in enumerate(fieldList):
            value = row[ind + 2]
            if value == "" or value == None:
                rowValues.append("NULL")
            else:
                formatValue = LOCALE.format(localeDict[field], value)
                rowValues.append(formatValue)

        #### Keep TRack of Bad Records ####
        if badRow:
            badIDs.append(OID)

        #### Continue Based on Whether a Bad Row ####
        outRow = delimiter.join(rowValues)
        fo.write("%s\n" % outRow.encode("utf-8"))

        ARCPY.SetProgressorPosition()

    #### Clean Up ####
    del rows
    fo.close()
    ARCPY.AddMessage(outFile)

    #### Get Set of Bad IDs ####
    badIDs = list(set(badIDs))
    badIDs.sort()
    badIDs = [str(i) for i in badIDs]

#.........这里部分代码省略.........
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:103,代码来源:ExportXYV.py

示例9: runModels

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getFieldNames [as 别名]
    def runModels(self):
        """Performs additional validation and populates the
        SSDataObject."""

        #### Shorthand Attributes ####
        ssdo = self.ssdo

        #### Create Dependent Variable ####
        self.y = ssdo.fields[self.dependentVar].returnDouble()
        self.n = ssdo.numObs
        self.y.shape = (self.n, 1)

        #### Assure that Variance is Larger than Zero ####
        yVar = NUM.var(self.y)
        if NUM.isnan(yVar) or yVar <= 0.0:
            ARCPY.AddIDMessage("Error", 906)
            raise SystemExit()

        #### Validate Chosen Number of Combos ####
        k = len(ssdo.fields)
        if self.maxIndVars > (k - 1):
            ARCPY.AddIDMessage("WARNING", 1171, self.maxIndVars)
            self.maxIndVars = k - 1
            ARCPY.AddIDMessage("WARNING", 1172, self.maxIndVars)

        #### Assure Degrees of Freedom ####
        withIntercept = self.maxIndVars + 1
        dof = self.n - withIntercept
        if dof <= 2:
            ARCPY.AddIDMessage("WARNING", 1128, 2)
            dofLimit = self.n - 4
            ARCPY.AddIDMessage("WARNING", 1419, dofLimit)
            self.maxIndVars = dofLimit

        if self.maxIndVars < 1:
            ARCPY.AddIDMessage("WARNING", 1173)

        #### Assure Min Vars is less than or equal to Max Vars ####
        if self.maxIndVars < self.minIndVars:
            ARCPY.AddIDMessage("WARNING", 1174)
            ARCPY.AddIDMessage("WARNING", 1175)
            self.minIndVars = self.maxIndVars

        #### Gen Range Combos ####
        rangeVars = range(1, k)
        rangeCombos = NUM.arange(self.minIndVars, self.maxIndVars+1)

        #### Create Base Design Matrix ####
        self.x = NUM.ones((self.n, k), dtype = float)
        for column, variable in enumerate(self.independentVars):
            self.x[:,column + 1] = ssdo.fields[variable].data

        #### Calculate Global VIF ####
        self.globalVifVals = COLL.defaultdict(float)
        if k > 2:
            #### Values Less Than One Were Forced by Psuedo-Inverse ####
            self.printVIF = True
        else:
            self.printVIF = False

        #### Create Output Table Info ####
        if self.outputTable:

            #### List of Results ####
            self.tableResults = []

            #### Valid Table Name and Type ####
            self.outputTable, dbf = UTILS.returnTableName(self.outputTable)
            outPath, outName = OS.path.split(self.outputTable)

            #### Set Field Names (Base) ####
            self.outFieldNames = UTILS.getFieldNames(erFieldNames, outPath)
            self.outFieldTypes = ["LONG", "DOUBLE", "DOUBLE", "DOUBLE",
                                  "DOUBLE", "DOUBLE", "DOUBLE", "LONG"]

            #### Add Field Names (Independent Vars as X#) ####
            maxRange = range(1, self.maxIndVars+1)
            self.outFieldNames += [ "X" + str(j) for j in maxRange ]
            self.outFieldTypes += ["TEXT"] * self.maxIndVars

            #### Calculate Max Text Length for Output Fields ####
            fieldLens = [ len(i) for i in self.independentVars ]
            self.maxFieldLen = max(fieldLens) + 5
            tableReportCount = 0

            #### Set NULL Values and Flag to Reset Table Name ####
            isNullable = UTILS.isNullable(self.outputTable)
            if isNullable:
                self.nullValue = NUM.nan
            else:
                self.nullValue = UTILS.shpFileNull["DOUBLE"]
            self.dbf = dbf

        #### Create Output Report File ####
        if self.outputReportFile:
            fo = UTILS.openFile(self.outputReportFile, "w")

        #### Hold Results for Every Choose Combo ####
        self.resultDict = {}
        self.vifVarCount = COLL.defaultdict(int)
#.........这里部分代码省略.........
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:103,代码来源:ExploratoryRegression.py

示例10: createOutput

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getFieldNames [as 别名]
    def createOutput(self, outputTable, displayIt = False):
        """Creates K-Function Output Table.

        INPUTS
        outputTable (str): path to the output table
        displayIt {bool, False}: create output graph?
        """

        #### Allow Overwrite Output ####
        ARCPY.env.overwriteOutput = 1

        #### Get Output Table Name With Extension if Appropriate ####
        outputTable, dbf = UTILS.returnTableName(outputTable)

        #### Set Progressor ####
        ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84008))

        #### Delete Table If Exists ####
        UTILS.passiveDelete(outputTable)

        #### Create Table ####
        outPath, outName = OS.path.split(outputTable)
        try:
            DM.CreateTable(outPath, outName)
        except:
            ARCPY.AddIDMessage("ERROR", 541)
            raise SystemExit()

        #### Add Result Fields ####
        fn = UTILS.getFieldNames(kOutputFieldNames, outPath) 
        expectedKName, observedKName, diffKName, lowKName, highKName = fn
        outputFields = [expectedKName, observedKName, diffKName]
        if self.permutations:
            outputFields += [lowKName, highKName] 

        for field in outputFields:
            UTILS.addEmptyField(outputTable, field, "DOUBLE")

        #### Create Insert Cursor ####
        try:
            insert = DA.InsertCursor(outputTable, outputFields)
        except:
            ARCPY.AddIDMessage("ERROR", 204)
            raise SystemExit()

        #### Add Rows to Output Table ####
        for testIter in xrange(self.nIncrements):
            distVal = self.cutoffs[testIter]
            ldVal = self.ld[testIter]
            diffVal = ldVal - distVal
            rowResult = [distVal, ldVal, diffVal]
            if self.permutations:
                ldMinVal = self.ldMin[testIter]
                ldMaxVal = self.ldMax[testIter]
                rowResult += [ldMinVal, ldMaxVal]
            insert.insertRow(rowResult)

        #### Clean Up ####
        del insert

        #### Make Table Visable in TOC if *.dbf Had To Be Added ####
        if dbf:
            ARCPY.SetParameterAsText(1, outputTable)

        #### Display Results ####
        if displayIt:
            if "WIN" in SYS.platform.upper():
                #### Set Progressor ####
                ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84186))

                #### Get Image Directory ####
                imageDir = UTILS.getImageDir()

                #### Make List of Fields and Set Template File ####
                yFields = [expectedKName, observedKName]
                if self.permutations:
                    #### Add Confidence Envelopes ####
                    yFields.append(highKName)
                    yFields.append(lowKName)
                    tee = OS.path.join(imageDir, "KFunctionPlotEnv.tee")
                else:
                    tee = OS.path.join(imageDir, "KFunctionPlot.tee")

                xFields = [ expectedKName for i in yFields ]

                #### Create Data Series String ####
                dataStr = UTILS.createSeriesStr(xFields, yFields, outputTable)

                #### Make Graph ####
                DM.MakeGraph(tee, dataStr, "KFunction")
                ARCPY.SetParameterAsText(11, "KFunction")

            else:
                ARCPY.AddIDMessage("Warning", 942)
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:96,代码来源:KFunction.py

示例11: createOutput

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import getFieldNames [as 别名]
    def createOutput(self, outputFC):
        """Creates an Output Feature Class with the Standard Distances.

        INPUTS:
        outputFC (str): path to the output feature class
        """

        #### Validate Output Workspace ####
        ERROR.checkOutputPath(outputFC)

        #### Shorthand Attributes ####
        ssdo = self.ssdo
        caseField = self.caseField

        #### Increase Extent if not Projected ####
        if ssdo.spatialRefType != "Projected":
            seValues = self.se.values()
            if len(seValues):
                maxSE = NUM.array([ i[0:2] for i in seValues ]).max()
                largerExtent = UTILS.increaseExtentByConstant(ssdo.extent,
                                                        constant = maxSE)
                largerExtent = [ LOCALE.str(i) for i in largerExtent ]
                ARCPY.env.XYDomain = " ".join(largerExtent)

        #### Create Output Feature Class ####
        ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84003))
        outPath, outName = OS.path.split(outputFC)

        try:
            DM.CreateFeatureclass(outPath, outName, "POLYGON", 
                                  "", ssdo.mFlag, ssdo.zFlag, 
                                  ssdo.spatialRefString)
        except:
            ARCPY.AddIDMessage("ERROR", 210, outputFC)
            raise SystemExit()

        #### Add Fields to Output FC ####
        dataFieldNames = UTILS.getFieldNames(seFieldNames, outPath)
        shapeFieldNames = ["[email protected]"]
        for fieldName in dataFieldNames:
            UTILS.addEmptyField(outputFC, fieldName, "DOUBLE")

        caseIsDate = False
        if caseField:
            fcCaseField = ssdo.allFields[caseField]
            validCaseName = UTILS.validQFieldName(fcCaseField, outPath)
            caseType = UTILS.convertType[fcCaseField.type]
            UTILS.addEmptyField(outputFC, validCaseName, caseType)
            dataFieldNames.append(validCaseName)
            if caseType.upper() == "DATE":
                caseIsDate = True

        #### Write Output ####
        badCaseRadians = []
        allFieldNames = shapeFieldNames + dataFieldNames
        rows = DA.InsertCursor(outputFC, allFieldNames)
        for case in self.caseKeys:

            #### Get Results ####
            xVal, yVal = self.meanCenter[case]
            seX, seY, degreeRotation, radianR1, radianR2 = self.se[case]
            seX2 = seX**2.0
            seY2 = seY**2.0

            #### Create Empty Polygon Geomretry ####
            poly = ARCPY.Array()

            #### Check for Valid Radius ####
            seXZero = UTILS.compareFloat(0.0, seX, rTol = .0000001)
            seXNan = NUM.isnan(seX)
            seXBool = seXZero + seXNan
            seYZero = UTILS.compareFloat(0.0, seY, rTol = .0000001)
            seYNan = NUM.isnan(seY)
            seYBool = seYZero + seYNan
            if seXBool or seYBool:
                badRadian = 6
                badCase = UTILS.caseValue2Print(case, self.caseIsString)
                badCaseRadians.append(badCase)
            else:
                badRadian = 0
                cosRadian = NUM.cos(radianR1)
                sinRadian = NUM.sin(radianR1)

                #### Calculate a Point For Each ####
                #### Degree in Ellipse Polygon ####                
                for degree in NUM.arange(0, 360): 
                    try:
                        radians = UTILS.convert2Radians(degree)
                        tanVal2 = NUM.tan(radians)**2.0
                        dX = MATH.sqrt((seX2 * seY2) /
                                      (seY2 + (seX2 * tanVal2)))
                        dY = MATH.sqrt((seY2 * (seX2 - dX**2.0)) /
                                       seX2)

                        #### Adjust for Quadrant ####
                        if 90 <= degree < 180:
                            dX = -dX
                        elif 180 <= degree < 270:
                            dX = -dX
                            dY = -dY
#.........这里部分代码省略.........
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:103,代码来源:StandardEllipse.py


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