本文整理汇总了Python中SSUtilities.passiveDelete方法的典型用法代码示例。如果您正苦于以下问题:Python SSUtilities.passiveDelete方法的具体用法?Python SSUtilities.passiveDelete怎么用?Python SSUtilities.passiveDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SSUtilities
的用法示例。
在下文中一共展示了SSUtilities.passiveDelete方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setStudyArea
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import passiveDelete [as 别名]
def setStudyArea(self):
"""Sets the study area for the nearest neighbor stat."""
#### Attribute Shortcuts ####
ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84248))
ssdo = self.ssdo
if self.studyArea == None:
#### Create Min Enc Rect ####
studyAreaFC = UTILS.returnScratchName("regularBound_FC")
clearedMinBoundGeom = UTILS.clearExtent(UTILS.minBoundGeomPoints)
clearedMinBoundGeom(ssdo.xyCoords, studyAreaFC,
geomType = "RECTANGLE_BY_AREA",
spatialRef = ssdo.spatialRef)
polyInfo = UTILS.returnPolygon(studyAreaFC,
spatialRef = ssdo.spatialRefString,
useGeodesic = ssdo.useChordal)
studyAreaPoly, studyArea = polyInfo
UTILS.passiveDelete(studyAreaFC)
if studyArea == None:
#### Invalid Study Area ####
ARCPY.AddIDMessage("Error", 932)
raise SystemExit()
self.studyArea = studyArea
示例2: cleanUp
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import passiveDelete [as 别名]
def cleanUp(self):
#### Delete Temp Structures ####
for tempItem in self.cleanUpList:
UTILS.passiveDelete(tempItem)
#### Reset Extent ####
ARCPY.env.extent = self.startExtent
#### Final Line Print ####
ARCPY.AddMessage("\n")
示例3: createOutput
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import passiveDelete [as 别名]
def createOutput(self, outputTable):
"""Creates Moran's I Step Output Table.
INPUTS
outputTable (str): path to the output table
"""
#### 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 ####
self.outputFields = []
for field in iaFieldNames:
fieldOut = ARCPY.ValidateFieldName(field, outPath)
UTILS.addEmptyField(outputTable, fieldOut, "DOUBLE")
self.outputFields.append(fieldOut)
#### Create Insert Cursor ####
try:
insert = DA.InsertCursor(outputTable, self.outputFields)
except:
ARCPY.AddIDMessage("ERROR", 204)
raise SystemExit()
#### Add Rows to Output Table ####
for testIter in xrange(self.nIncrements):
insert.insertRow(self.giResults[testIter])
#### Clean Up ####
del insert
return outputTable, dbf
示例4: cleanUp
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import passiveDelete [as 别名]
def cleanUp(self):
"""Removes Objects and Temp Files from Memory for the
k-Function."""
if self.tempStudyArea:
UTILS.passiveDelete(self.studyAreaFC)
try:
del self.ssdo.gaTable
except:
pass
try:
del self.kTable
except:
pass
示例5: createOutput
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import passiveDelete [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)
示例6: initialize
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import passiveDelete [as 别名]
def initialize(self):
"""Reads data into a GA structure for neighborhood searching and
sets the study area envelope."""
#### Shorthand Attributes ####
ssdo = self.ssdo
weightField = self.weightField
if weightField:
fieldList = [weightField]
else:
fieldList = []
#### Create GA Data Structure ####
ssdo.obtainDataGA(ssdo.oidName, fieldList, minNumObs = 3,
warnNumObs = 30)
N = len(ssdo.gaTable)
#### Get Weights ####
if weightField:
weights = ssdo.fields[weightField].returnDouble()
#### Report No Weights ####
weightSum = weights.sum()
if not weightSum > 0.0:
ARCPY.AddIDMessage("ERROR", 898)
raise SystemExit()
#### Set Study Area ####
ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84248))
clearedMinBoundGeom = UTILS.clearExtent(UTILS.minBoundGeomPoints)
#### Set Initial Study Area FC ####
if self.studyAreaMethod == 1 and self.studyAreaFC:
#### Assure Only A Single Polygon in Study Area FC ####
polyCount = UTILS.getCount(self.studyAreaFC)
if polyCount != 1:
ARCPY.AddIDMessage("ERROR", 936)
raise SystemExit()
self.tempStudyArea = False
#### Read User Provided Study Area ####
polyInfo = UTILS.returnPolygon(self.studyAreaFC,
spatialRef = ssdo.spatialRefString)
self.studyAreaPoly, self.studyArea = polyInfo
#### Create Temp Min. Enc. Rectangle and Class ####
tempMBG_FC = UTILS.returnScratchName("tempMBG_FC")
clearedMinBoundGeom(self.studyAreaPoly, tempMBG_FC,
geomType = "RECTANGLE_BY_AREA",
spatialRef = ssdo.spatialRef)
self.minRect = UTILS.MinRect(tempMBG_FC)
UTILS.passiveDelete(tempMBG_FC)
else:
#### Create Min. Enc. Rectangle ####
self.studyAreaFC = UTILS.returnScratchName("regularBound_FC")
self.tempStudyArea = True
clearedMinBoundGeom(ssdo.xyCoords, self.studyAreaFC,
geomType = "RECTANGLE_BY_AREA",
spatialRef = ssdo.spatialRef)
polyInfo = UTILS.returnPolygon(self.studyAreaFC,
spatialRef = ssdo.spatialRefString)
self.studyAreaPoly, self.studyArea = polyInfo
#### Create Min. Enc. Rectangle Class ####
self.minRect = UTILS.MinRect(self.studyAreaFC)
if self.reduce:
#### Only Need To Create FC if Reduce Buffer ####
UTILS.createPolygonFC(self.studyAreaFC, self.studyAreaPoly,
spatialRef = ssdo.spatialRefString)
#### Set Extent and Envelope and Min Rect ####
self.envelope = UTILS.Envelope(ssdo.extent)
self.maxDistance = self.minRect.maxLength * 0.25
if self.maxDistance > (self.minRect.minLength * .5):
#### 25% of Max Extent is Larger Than Half Min Extent ####
#### Results in Reduced Study Area Failure ####
if self.reduce:
self.maxDistance = self.minRect.minLength * 0.25
#### Determine Distance Increment ####
if not self.dIncrement:
if self.begDist:
distRange = self.maxDistance - self.begDist
else:
distRange = self.maxDistance
self.dIncrement = float(distRange / self.nIncrements)
#### Determine Starting Distance ####
if not self.begDist:
self.begDist = self.dIncrement
#### Determine All Distance Cutoffs ####
rangeInc = xrange(self.nIncrements)
cutoffs = []
for inc in rangeInc:
val = (inc * self.dIncrement) + self.begDist
cutoffs.append(val)
#.........这里部分代码省略.........
示例7: doFishnet
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import passiveDelete [as 别名]
#.........这里部分代码省略.........
#### Cell Size Answer ####
snapStr = self.ssdo.distanceInfo.printDistance(dist)
msg = ARCPY.GetIDMessage(84450).format(snapStr)
printOHSAnswer(msg)
self.fish = fish
#### Fishnet Count Subject ####
printOHSSubject(84451, addNewLine = False)
#### Create Temp Fishnet Grid ####
gridFC = UTILS.returnScratchName("Fishnet_TempFC")
self.cleanUpList.append(gridFC)
#### Apply Output Coords to Create Fishnet ####
oldSpatRef = ARCPY.env.outputCoordinateSystem
ARCPY.env.outputCoordinateSystem = fishOutputCoords
#### Fish No Extent ####
oldExtent = ARCPY.env.extent
ARCPY.env.extent = ""
#### Apply Max XY Tolerance ####
fishWithXY = UTILS.funWithXYTolerance(DM.CreateFishnet,
self.ssdo.distanceInfo)
#### Execute Fishnet ####
fishWithXY(gridFC, self.fish.origin, self.fish.rotate,
self.fish.quadLength, self.fish.quadLength,
self.fish.numRows, self.fish.numCols, self.fish.corner,
"NO_LABELS", self.fish.extent, "POLYGON")
#### Project Back to GCS if Use Chordal ####
if collSSDO.useChordal:
gridFC_ProjBack = UTILS.returnScratchName("TempFC_Proj")
DM.Project(gridFC, gridFC_ProjBack, collSSDO.spatialRef)
UTILS.passiveDelete(gridFC)
gridFC = gridFC_ProjBack
#### Set Env Output Coords Back ####
ARCPY.env.outputCoordinateSystem = oldSpatRef
#### Create Empty Field Mappings to Ignore Atts ####
fieldMap = ARCPY.FieldMappings()
fieldMap.addTable(self.ssdo.inputFC)
fieldMap.removeAll()
#### Fishnet Count Answer ####
printOHSAnswer(ARCPY.GetIDMessage(countMSGNumber))
#### Create Weighted Fishnet Grid ####
tempFC = UTILS.returnScratchName("Optimized_TempFC")
self.cleanUpList.append(tempFC)
joinWithXY = UTILS.funWithXYTolerance(ANA.SpatialJoin,
self.ssdo.distanceInfo)
joinWithXY(gridFC, self.ssdo.inputFC, tempFC,
"JOIN_ONE_TO_ONE", "KEEP_ALL", "EMPTY")
#### Clean Up Temp FCs ####
UTILS.passiveDelete(gridFC)
#### Remove Locations Outside Boundary FC ####
featureLayer = "ClippedPointFC"
DM.MakeFeatureLayer(tempFC, featureLayer)
if self.boundaryFC:
msg = ARCPY.GetIDMessage(84454)
ARCPY.SetProgressor("default", msg)
DM.SelectLayerByLocation(featureLayer, "INTERSECT",
self.boundaryFC, "#",
"NEW_SELECTION")
DM.SelectLayerByLocation(featureLayer, "INTERSECT",
"#", "#", "SWITCH_SELECTION")
DM.DeleteFeatures(featureLayer)
else:
if additionalZeroDistScale == "ALL":
msg = ARCPY.GetIDMessage(84455)
ARCPY.SetProgressor("default", msg)
DM.SelectLayerByAttribute(featureLayer, "NEW_SELECTION",
'"Join_Count" = 0')
DM.DeleteFeatures(featureLayer)
else:
distance = additionalZeroDistScale * fish.quadLength
distanceStr = self.ssdo.distanceInfo.linearUnitString(distance,
convert = True)
nativeStr = self.ssdo.distanceInfo.printDistance(distance)
msg = "Removing cells further than %s from input pointsd...."
ARCPY.AddMessage(msg % nativeStr)
DM.SelectLayerByLocation(featureLayer, "INTERSECT",
self.ssdo.inputFC, distanceStr,
"NEW_SELECTION")
DM.SelectLayerByLocation(featureLayer, "INTERSECT",
"#", "#", "SWITCH_SELECTION")
DM.DeleteFeatures(featureLayer)
DM.Delete(featureLayer)
del collSSDO
ARCPY.env.extent = oldExtent
self.createAnalysisSSDO(tempFC, "JOIN_COUNT")