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


Python SSUtilities.resetExtent方法代码示例

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


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

示例1: obtainData

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import resetExtent [as 别名]

#.........这里部分代码省略.........
            badXY = row[1].count(None)
            if self.hasZ:
                badValues = row[0:-1].count(None)
            else:
                badValues = row.count(None)

            #### Check Bad Record ####
            if badXY or badValues:
                badRow = 1
                badRecord = 1
                badIDs.append(oid)
            else:
                #### Get Centroid and Master ID ####
                xyCoords[c] = row[1]
                masterID = row[self.masterColumnIndex]

                #### Add Field Values ####
                if numFields:
                    restFields = row[self.dataColumnIndex:]
                    for fieldInd, fieldName in enumerate(fields):
                        fieldValue = restFields[fieldInd]
                        fieldType = fieldTypes[fieldName]
                        if fieldType.upper() == "DATE":
                            if dateStr:
                                fieldValue = str(fieldValue)
                            else:
                                fieldValue = (nowTime - fieldValue).total_seconds()
                        self.fields[fieldName].data[c] = fieldValue
                if self.hasZ:
                    zCoords[c] = row[-1]

                #### Check uniqueness of masterID field ####
                if self.master2Order.has_key(masterID):
                    del rows
                    ARCPY.AddIDMessage("ERROR", 644, masterField)
                    ARCPY.AddIDMessage("ERROR", 643)
                    raise SystemExit()
                else:
                    self.master2Order[masterID] = c
                    self.order2Master[c] = masterID
                    c += 1

            ARCPY.SetProgressorPosition()

        del rows

        #### Check Whether the Number of Features is Appropriate ####
        numObs = len(self.master2Order)
        ERROR.checkNumberOfObs(numObs, minNumObs = minNumObs,
                               warnNumObs = warnNumObs,
                               silentWarnings = self.silentWarnings)

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

        #### Process any bad records encountered ####
        if badRecord != 0:
            bn = len(badIDs)
            if not self.silentWarnings:
                ERROR.reportBadRecords(cnt, bn, badIDs, label = self.oidName,
                                       explicitBadRecordID = explicitBadRecordID)

            #### Prune Data Arrays ####
            xyCoords = xyCoords[0:numObs]
            self.resizeDataArrays(numObs)
            if self.hasZ:
                zCoords = zCoords[0:numObs]

        #### Set the Hidden Fields (E.g. Not in Use) ####
        self.setHiddenFields()

        #### Reset Extent to Honor Env and Subsets ####
        try:
            self.extent = UTILS.resetExtent(xyCoords)
        except:
            pass

        #### Reset Coordinates for Chordal ####
        if self.useChordal:
            #### Project to XY on Spheroid ####
            self.spheroidCoords = ARC._ss.lonlat_to_xy(xyCoords, 
                                                self.spatialRef) 
            self.sliceInfo = UTILS.SpheroidSlice(self.extent,
                                                self.spatialRef)
        else:
            self.spheroidCoords = None
            self.sliceInfo = None

        #### Set Further Attributes ####
        self.badRecords = badIDs
        self.xyCoords = xyCoords
        self.masterField = masterField
        self.gaTable = None
        self.numObs = numObs
        if self.hasZ:
            self.zCoords = zCoords
        else:
            self.zCoords = None
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:104,代码来源:SSDataObject.py

示例2: spaceTime2SWM

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import resetExtent [as 别名]

#.........这里部分代码省略.........
        neighDist = ARC._ss.NeighborDistances(gaTable, gaSearch)
        N = len(neighDist)
        threshold = 0.0
        sumDist = 0.0 

        #### Find Maximum Nearest Neighbor Distance ####
        for row in xrange(N):
            dij = neighDist[row][-1][0]
            if dij > threshold:
                threshold = dij
            sumDist += dij

            ARCPY.SetProgressorPosition()

        #### Increase For Rounding Error ####
        threshold = threshold * 1.0001
        avgDist = sumDist / (N * 1.0)

        #### Add Linear/Angular Units ####
        thresholdStr = ssdo.distanceInfo.printDistance(threshold)
        ARCPY.AddIDMessage("Warning", 853, thresholdStr)

        #### Chordal Default Check ####
        if ssdo.useChordal:
            hardMaxExtent = ARC._ss.get_max_gcs_distance(ssdo.spatialRef)
            if threshold > hardMaxExtent:
                ARCPY.AddIDMessage("ERROR", 1609)
                raise SystemExit()

        #### Clean Up ####
        del gaSearch

    #### Create Missing SSDO Info ####
    extent = UTILS.resetExtent(xyCoords)

    #### Reset Coordinates for Chordal ####
    if ssdo.useChordal:
        sliceInfo = UTILS.SpheroidSlice(extent, ssdo.spatialRef)
        maxExtent = sliceInfo.maxExtent
    else:
        env = UTILS.Envelope(extent)
        maxExtent = env.maxExtent

    threshold = checkDistanceThresholdSWM(ssdo, threshold, maxExtent)
    
    #### Set Default Progressor for Neigborhood Structure ####
    ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84143))

    #### Create Distance Neighbor Search Type ####
    gaSearch = GAPY.ga_nsearch(gaTable)
    gaSearch.init_nearest(threshold, 0, gaConcept)
    neighSearch = ARC._ss.NeighborSearch(gaTable, gaSearch)

    #### Set Progressor for Weights Writing ####
    ARCPY.SetProgressor("step", ARCPY.GetIDMessage(84127), 0, numObs, 1)

    #### Initialize Spatial Weights Matrix File ####
    swmWriter = WU.SWMWriter(swmFile, masterField, ssdo.spatialRefName, 
                             numObs, rowStandard, inputFC = inputFC,
                             wType = 9, distanceMethod = concept,
                             threshold = threshold, timeField = timeField,
                             timeType = timeType, timeValue = timeValue)

    for row in xrange(numObs):
        masterID = gaTable[row][2]
开发者ID:leochin,项目名称:GSWMtest,代码行数:69,代码来源:Weights.py

示例3: obtainDataGA

# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import resetExtent [as 别名]

#.........这里部分代码省略.........
        numFields = len(fields)
        for field in fields:
            fType = ERROR.checkField(self.allFields, field, types = types)
            fieldList.append(field)
            self.fields[field] = self.allFields[field]

        #### ZCoords Are Last ####
        getZBool = self.hasZ and (not self.renderType)
        if getZBool:
            fieldList.append("SHAPE&Z")

        #### Create GA Data Structure ####
        cnt = UTILS.getCount(self.inputFC)
        fieldList = tuple(fieldList)
        gaTable, gaInfo = WU.gaTable(self.inputFC, fieldNames = fieldList,
                                     spatRef = self.spatialRefString)

        #### Check Whether the Number of Features is Appropriate ####
        numObs = gaInfo[0]
        ERROR.checkNumberOfObs(numObs, minNumObs = minNumObs,
                               warnNumObs = warnNumObs,
                               silentWarnings = self.silentWarnings)

        #### Process any bad records encountered ####
        numBadIDs = cnt - numObs
        if numBadIDs:
            badIDs = WU.parseGAWarnings(gaTable.warnings)
            if not self.silentWarnings:
                ERROR.reportBadRecords(cnt, numBadIDs, badIDs,
                                       label = self.oidName)
        else:
            badIDs = []

        #### Initialization of Centroids  ####
        xyCoords = NUM.empty((numObs, 2), float)

        #### Z Coords ####
        if self.hasZ:
            zCoords = NUM.empty((numObs, ), float)

        #### Create Empty Data Arrays ####
        for fieldName, fieldObj in self.fields.iteritems():
            fieldObj.createDataArray(numObs)

        #### Populate SSDataObject ####
        ARCPY.SetProgressor("step", ARCPY.GetIDMessage(84001), 0, numObs, 1)
        for row in xrange(numObs):
            rowInfo = gaTable[row]
            x,y = rowInfo[1]
            masterID = int(rowInfo[self.masterColumnIndex])
            if self.master2Order.has_key(masterID):
                ARCPY.AddIDMessage("ERROR", 644, masterField)
                ARCPY.AddIDMessage("ERROR", 643)
                raise SystemExit()
            else:
                self.master2Order[masterID] = row
                self.order2Master[row] = masterID
                xyCoords[row] = (x, y)
            if numFields:
                restFields = rowInfo[self.dataColumnIndex:]
                for fieldInd, fieldName in enumerate(fields):
                    self.fields[fieldName].data[row] = restFields[fieldInd]
            if self.hasZ:
                if getZBool:
                    zCoords[row] = rowInfo[-1]
                else:
                    zCoords[row] = NUM.nan

            ARCPY.SetProgressorPosition()

        #### Set the Hidden Fields (E.g. Not in Use) ####
        self.setHiddenFields()

        #### Reset Extent to Honor Env and Subsets ####
        try:
            self.extent = UTILS.resetExtent(xyCoords)
        except:
            pass

        #### Reset Coordinates for Chordal ####
        if self.useChordal:
            #### Project to XY on Spheroid ####
            self.spheroidCoords = ARC._ss.lonlat_to_xy(xyCoords,
                                                self.spatialRef) 
            self.sliceInfo = UTILS.SpheroidSlice(self.extent,
                                                self.spatialRef)
        else:
            self.spheroidCoords = None
            self.sliceInfo = None

        #### Set Further Attributes ####
        self.badRecords = badIDs
        self.xyCoords = xyCoords
        self.masterField = masterField
        self.gaTable = gaTable
        self.numObs = numObs
        if self.hasZ:
            self.zCoords = zCoords
        else:
            self.zCoords = None
开发者ID:rvinc66,项目名称:ArcGISRuntimeBook,代码行数:104,代码来源:SSDataObject.py


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