本文整理汇总了Python中SSUtilities.returnScratchName方法的典型用法代码示例。如果您正苦于以下问题:Python SSUtilities.returnScratchName方法的具体用法?Python SSUtilities.returnScratchName怎么用?Python SSUtilities.returnScratchName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SSUtilities
的用法示例。
在下文中一共展示了SSUtilities.returnScratchName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: validateRaster
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import returnScratchName [as 别名]
def validateRaster(self, ssdoCoords):
printOHSSubject(84439, addNewLine = False)
envMask = ARCPY.env.mask
maskExists = False
if envMask:
try:
descMask = ARCPY.Describe(envMask)
maskExists = True
except:
maskExists = False
if not envMask or not maskExists:
#### Use Convex Hull ####
msg = ARCPY.GetIDMessage(84440)
ARCPY.SetProgressor("default", msg)
printOHSAnswer(msg)
boundaryFC = UTILS.returnScratchName("tempCH_FC")
UTILS.minBoundGeomPoints(ssdoCoords, boundaryFC,
geomType = "CONVEX_HULL",
spatialRef = self.ssdo.spatialRef)
self.boundaryFC = boundaryFC
self.cleanUpList.append(boundaryFC)
self.maskExists = maskExists
示例2: doPoint2Poly
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import returnScratchName [as 别名]
def doPoint2Poly(self):
#### Initial Data Assessment ####
printOHSSection(84428, prependNewLine = True)
printOHSSubject(84431, addNewLine = False)
self.ssdo.obtainData(self.ssdo.oidName)
self.checkIncidents(self.ssdo.numObs)
if len(self.ssdo.badRecords):
ARCPY.AddMessage("\n")
#################################
#### Checking Polygon Message ####
printOHSSubject(84430, addNewLine = False)
#### Spatial Join (Hold Messages) ####
outputFieldMaps = "EMPTY"
tempFC = UTILS.returnScratchName("SpatialJoin_TempFC")
self.cleanUpList.append(tempFC)
joinWithSpatialRef = UTILS.funWithSpatialRef(ANA.SpatialJoin,
self.ssdo.spatialRef,
outputFC = tempFC)
joinWithXY = UTILS.funWithXYTolerance(joinWithSpatialRef,
self.ssdo.distanceInfo)
joinWithXY(self.polygonFC, self.ssdo.inputFC, tempFC,
"JOIN_ONE_TO_ONE", "KEEP_ALL",
outputFieldMaps)
#### Set VarName, MasterField, AnalysisSSDO ####
self.createAnalysisSSDO(tempFC, "JOIN_COUNT")
示例3: setStudyArea
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import returnScratchName [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
示例4: checkBoundary
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import returnScratchName [as 别名]
def checkBoundary(self):
printOHSSubject(84486, addNewLine = False)
#### Assure That There Is Only a Single Polygon ####
cnt = UTILS.getCount(self.boundaryFC)
if cnt > 1:
#### Dissolve Polys into Boundary ####
dissolveFC = UTILS.returnScratchName("Dissolve_TempFC")
DM.Dissolve(self.boundaryFC, dissolveFC, "#", "#", "SINGLE_PART",
"DISSOLVE_LINES")
self.boundaryFC = dissolveFC
self.cleanUpList.append(dissolveFC)
#### Read Boundary FC ####
ssdoBound = SSDO.SSDataObject(self.boundaryFC,
explicitSpatialRef = self.ssdo.spatialRef,
silentWarnings = True,
useChordal = True)
polyDict, polyAreas = UTILS.readPolygonFC(self.boundaryFC,
spatialRef = self.ssdo.spatialRef,
useGeodesic = self.ssdo.useChordal)
self.boundArea = sum(polyAreas.values())
self.boundExtent = getPolyExtent(polyDict)
del ssdoBound
if UTILS.compareFloat(0.0, self.boundArea):
#### Invalid Study Area ####
ARCPY.AddIDMessage("ERROR", 932)
self.cleanUp()
raise SystemExit()
else:
areaStr = self.ssdo.distanceInfo.printDistance(self.boundArea)
msg = ARCPY.GetIDMessage(84492).format(areaStr)
printOHSAnswer(msg)
示例5: reportHTML
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import returnScratchName [as 别名]
def reportHTML(self, htmlFile = None):
"""Generates a graphical html report for Moran's I."""
#### Shorthand Attributes ####
zi = self.zi
#### Progress and Create HTML File Name ####
writeMSG = ARCPY.GetIDMessage(84228)
ARCPY.SetProgressor("default", writeMSG)
ARCPY.AddMessage(writeMSG)
if not htmlFile:
prefix = ARCPY.GetIDMessage(84227)
outputDir = UTILS.returnScratchWorkSpace()
baseDir = UTILS.getBaseFolder(outputDir)
htmlFile = UTILS.returnScratchName(prefix, fileType = "TEXT",
scratchWS = baseDir,
extension = "html")
#### Obtain Correct Images ####
imageDir = UTILS.getImageDir()
clustStr = ARCPY.GetIDMessage(84243)
dispStr = ARCPY.GetIDMessage(84244)
if zi <= -2.58:
imageFile = OS.path.join(imageDir, "dispersedValues01.png")
info = ("1%", dispStr)
imageBox = OS.path.join(imageDir, "dispersedBox01.png")
elif (-2.58 < zi <= -1.96):
imageFile = OS.path.join(imageDir, "dispersedValues05.png")
info = ("5%", dispStr)
imageBox = OS.path.join(imageDir, "dispersedBox05.png")
elif (-1.96 < zi <= -1.65):
imageFile = OS.path.join(imageDir, "dispersedValues10.png")
info = ("10%", dispStr)
imageBox = OS.path.join(imageDir, "dispersedBox10.png")
elif (-1.65 < zi < 1.65):
imageFile = OS.path.join(imageDir, "randomValues.png")
imageBox = OS.path.join(imageDir, "randomBox.png")
elif (1.65 <= zi < 1.96):
imageFile = OS.path.join(imageDir, "clusteredValues10.png")
info = ("10%", clustStr)
imageBox = OS.path.join(imageDir, "clusteredBox10.png")
elif (1.96 <= zi < 2.58):
imageFile = OS.path.join(imageDir, "clusteredValues05.png")
info = ("5%", clustStr)
imageBox = OS.path.join(imageDir, "clusteredBox05.png")
else:
imageFile = OS.path.join(imageDir, "clusteredValues01.png")
info = ("1%", clustStr)
imageBox = OS.path.join(imageDir, "clusteredBox01.png")
#### Footnote ####
footStart = ARCPY.GetIDMessage(84230).format(zi)
if abs(zi) >= 1.65:
footEnd = ARCPY.GetIDMessage(84231)
footEnd = footEnd.format(*info)
footerText = footStart + footEnd
else:
footEnd = ARCPY.GetIDMessage(84232)
footerText = footStart + footEnd
#### Root Element ####
title = ARCPY.GetIDMessage(84229)
reportElement, reportTree = REPORT.xmlReport(title = title)
#### Begin Graphic SubElement ####
graphicElement = REPORT.xmlGraphic(reportElement, imageFile,
footerText = footerText)
#### Floating Table ####
rowVals = [ [ARCPY.GetIDMessage(84148), self.giString, ""],
[ARCPY.GetIDMessage(84151), self.ziString, imageBox],
[ARCPY.GetIDMessage(84152), self.pvString, ""] ]
fTable = REPORT.xmlTable(graphicElement, rowVals,
tType = "ssFloat")
#### Moran Table ####
rowVals = [ [ARCPY.GetIDMessage(84148), self.giString],
[ARCPY.GetIDMessage(84149), self.eiString],
[ARCPY.GetIDMessage(84150), self.viString],
[ARCPY.GetIDMessage(84151), self.ziString],
[ARCPY.GetIDMessage(84152), self.pvString] ]
mTable = REPORT.xmlTable(reportElement, rowVals,
title = ARCPY.GetIDMessage(84160))
#### Dataset Table ####
rowVals = [ [UTILS.addColon(ARCPY.GetIDMessage(84233)),
self.ssdo.inputFC],
[UTILS.addColon(ARCPY.GetIDMessage(84016)),
self.varName],
[UTILS.addColon(ARCPY.GetIDMessage(84234)),
WU.wTypeDispatch[self.wType]],
[UTILS.addColon(ARCPY.GetIDMessage(84235)),
self.concept],
[UTILS.addColon(ARCPY.GetIDMessage(84236)),
str(self.rowStandard)],
[UTILS.addColon(ARCPY.GetIDMessage(84237)),
self.thresholdStr],
[UTILS.addColon(ARCPY.GetIDMessage(84238)),
#.........这里部分代码省略.........
示例6: initialize
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import returnScratchName [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 returnScratchName [as 别名]
def doFishnet(self):
#### Initial Data Assessment ####
printOHSSection(84428, prependNewLine = True)
printOHSSubject(84431, addNewLine = False)
#### Find Unique Locations ####
msg = ARCPY.GetIDMessage(84441)
ARCPY.SetProgressor("default", msg)
initCount = UTILS.getCount(self.ssdo.inputFC)
self.checkIncidents(initCount)
collectedPointFC = UTILS.returnScratchName("Collect_InitTempFC")
collInfo = EVENTS.collectEvents(self.ssdo, collectedPointFC)
self.cleanUpList.append(collectedPointFC)
collSSDO = SSDO.SSDataObject(collectedPointFC,
explicitSpatialRef = self.ssdo.spatialRef,
useChordal = True)
collSSDO.obtainDataGA(collSSDO.oidName)
#################################
if self.boundaryFC:
#### Assure Boundary FC Has Area and Obtain Chars ####
self.checkBoundary()
#### Location Outliers ####
lo = UTILS.LocationInfo(collSSDO, concept = "EUCLIDEAN",
silentThreshold = True, stdDeviations = 3)
printOHSLocationalOutliers(lo, aggType = self.aggType)
#### Agg Header ####
printOHSSection(84444)
if self.boundaryFC:
extent = self.boundExtent
forMercExtent = self.boundExtent
countMSGNumber = 84453
else:
countMSGNumber = 84452
extent = None
forMercExtent = collSSDO.extent
if collSSDO.useChordal:
extentFC_GCS = UTILS.returnScratchName("TempGCS_Extent")
extentFC_Merc = UTILS.returnScratchName("TempMercator_Extent")
points = NUM.array([ [forMercExtent.XMin, forMercExtent.YMax],
[forMercExtent.XMax, forMercExtent.YMin] ])
UTILS.createPointFC(extentFC_GCS, points,
spatialRef = collSSDO.spatialRef)
DM.Project(extentFC_GCS, extentFC_Merc, mercatorProjection)
d = ARCPY.Describe(extentFC_Merc)
extent = d.extent
fishOutputCoords = mercatorProjection
else:
fishOutputCoords = self.ssdo.spatialRef
#### Fish Subject ####
printOHSSubject(84449, addNewLine = False)
dist = scaleDecision(lo.nonZeroAvgDist, lo.nonZeroMedDist)
area = 0.0
#### Construct Fishnet ####
fish = UTILS.FishnetInfo(collSSDO, area, extent,
explicitCellSize = dist)
dist = fish.quadLength
snap = self.ssdo.distanceInfo.linearUnitString(dist)
#### 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)
#.........这里部分代码省略.........
示例8: doIntegrate
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import returnScratchName [as 别名]
def doIntegrate(self):
#### Initial Data Assessment ####
printOHSSection(84428, prependNewLine = True)
printOHSSubject(84431, addNewLine = False)
#### Find Unique Locations ####
msg = ARCPY.GetIDMessage(84441)
ARCPY.SetProgressor("default", msg)
initCount = UTILS.getCount(self.ssdo.inputFC)
self.checkIncidents(initCount)
collectedPointFC = UTILS.returnScratchName("Collect_InitTempFC")
collInfo = EVENTS.collectEvents(self.ssdo, collectedPointFC)
self.cleanUpList.append(collectedPointFC)
collSSDO = SSDO.SSDataObject(collectedPointFC,
explicitSpatialRef = self.ssdo.spatialRef,
useChordal = True)
collSSDO.obtainDataGA(collSSDO.oidName)
#################################
#### Locational Outliers ####
lo = UTILS.LocationInfo(collSSDO, concept = "EUCLIDEAN",
silentThreshold = True, stdDeviations = 3)
printOHSLocationalOutliers(lo, aggType = self.aggType)
#### Raster Boundary ####
if self.outputRaster:
self.validateRaster(collSSDO.xyCoords)
#### Agg Header ####
printOHSSection(84444)
#### Copy Features for Integrate ####
msg = ARCPY.GetIDMessage(84443)
ARCPY.SetProgressor("default", msg)
intFC = UTILS.returnScratchName("Integrated_TempFC")
self.cleanUpList.append(intFC)
DM.CopyFeatures(self.ssdo.inputFC, intFC)
#### Make Feature Layer To Avoid Integrate Bug with Spaces ####
mfc = "Integrate_MFC_2"
DM.MakeFeatureLayer(intFC, mfc)
self.cleanUpList.append(mfc)
#### Snap Subject ####
printOHSSubject(84442, addNewLine = False)
nScale = (collSSDO.numObs * 1.0) / self.cnt
if lo.nonZeroAvgDist < lo.nonZeroMedDist:
useDist = lo.nonZeroAvgDist * nScale
useType = "average"
else:
useDist = lo.nonZeroMedDist * nScale
useType = "median"
distance2Integrate = lo.distances[lo.distances < useDist]
distance2Integrate = NUM.sort(distance2Integrate)
numDists = len(distance2Integrate)
#### Max Snap Answer ####
msg = ARCPY.GetIDMessage(84445)
useDistStr = self.ssdo.distanceInfo.printDistance(useDist)
msg = msg.format(useDistStr)
printOHSAnswer(msg)
percs = [10, 25, 100]
indices = [ int(numDists * (i * .01)) for i in percs ]
if indices[-1] >= numDists:
indices[-1] = -1
ARCPY.SetProgressor("default", msg)
for pInd, dInd in enumerate(indices):
dist = distance2Integrate[dInd]
snap = self.ssdo.distanceInfo.linearUnitString(dist,
convert = True)
DM.Integrate(mfc, snap)
del collSSDO
#### Run Collect Events ####
collectedFC = UTILS.returnScratchName("Collect_TempFC")
self.cleanUpList.append(collectedFC)
intSSDO = SSDO.SSDataObject(intFC,
explicitSpatialRef = self.ssdo.spatialRef,
silentWarnings = True,
useChordal = True)
intSSDO.obtainDataGA(intSSDO.oidName)
EVENTS.collectEvents(intSSDO, collectedFC)
descTemp = ARCPY.Describe(collectedFC)
oidName = descTemp.oidFieldName
#### Delete Integrated FC ####
del intSSDO
#### Set VarName, MasterField, AnalysisSSDO ####
self.createAnalysisSSDO(collectedFC, "ICOUNT")
示例9: reportHTML
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import returnScratchName [as 别名]
def reportHTML(self, htmlFile = None):
"""Generates a graphical html report for Nearest Neighbor Stat."""
#### Shorthand Attributes ####
zScore = self.zn
#### Progress and Create HTML File Name ####
writeMSG = ARCPY.GetIDMessage(84228)
ARCPY.SetProgressor("default", writeMSG)
ARCPY.AddMessage(writeMSG)
if not htmlFile:
prefix = ARCPY.GetIDMessage(84240)
outputDir = UTILS.returnScratchWorkSpace()
baseDir = UTILS.getBaseFolder(outputDir)
htmlFile = UTILS.returnScratchName(prefix, fileType = "TEXT",
scratchWS = baseDir,
extension = "html")
#### Obtain Correct Images ####
imageDir = UTILS.getImageDir()
clustStr = ARCPY.GetIDMessage(84243)
dispStr = ARCPY.GetIDMessage(84244)
if zScore <= -2.58:
imageFile = OS.path.join(imageDir, "clusteredPoints01.png")
info = ("1%", clustStr)
imageBox = OS.path.join(imageDir, "dispersedBox01.png")
elif (-2.58 < zScore <= -1.96):
imageFile = OS.path.join(imageDir, "clusteredPoints05.png")
info = ("5%", clustStr)
imageBox = OS.path.join(imageDir, "dispersedBox05.png")
elif (-1.96 < zScore <= -1.65):
imageFile = OS.path.join(imageDir, "clusteredPoints10.png")
info = ("10%", clustStr)
imageBox = OS.path.join(imageDir, "dispersedBox10.png")
elif (-1.65 < zScore < 1.65):
imageFile = OS.path.join(imageDir, "randomPoints.png")
imageBox = OS.path.join(imageDir, "randomBox.png")
elif (1.65 <= zScore < 1.96):
imageFile = OS.path.join(imageDir, "dispersedPoints10.png")
info = ("10%", dispStr)
imageBox = OS.path.join(imageDir, "clusteredBox10.png")
elif (1.96 <= zScore < 2.58):
imageFile = OS.path.join(imageDir, "dispersedPoints05.png")
info = ("5%", dispStr)
imageBox = OS.path.join(imageDir, "clusteredBox05.png")
else:
imageFile = OS.path.join(imageDir, "dispersedPoints01.png")
info = ("1%", dispStr)
imageBox = OS.path.join(imageDir, "clusteredBox01.png")
#### Footnote ####
footStart = ARCPY.GetIDMessage(84230).format(zScore)
if abs(zScore) >= 1.65:
footEnd = ARCPY.GetIDMessage(84231)
footEnd = footEnd.format(*info)
footerText = footStart + footEnd
else:
footEnd = ARCPY.GetIDMessage(84232)
footerText = footStart + footEnd
#### Root Element ####
title = ARCPY.GetIDMessage(84161)
reportElement, reportTree = REPORT.xmlReport(title = title)
#### Begin Graphic SubElement ####
graphicElement = REPORT.xmlGraphic(reportElement, imageFile,
footerText = footerText)
#### Floating Table ####
rowVals = [ [ARCPY.GetIDMessage(84164), self.ratioString, ""],
[ARCPY.GetIDMessage(84151), self.znString, imageBox],
[ARCPY.GetIDMessage(84152), self.pvString, ""] ]
fTable = REPORT.xmlTable(graphicElement, rowVals,
tType = "ssFloat")
#### NN Table ####
rowVals = [ [ARCPY.GetIDMessage(84162), self.nnStringD],
[ARCPY.GetIDMessage(84163), self.enStringD],
[ARCPY.GetIDMessage(84164), self.ratioString],
[ARCPY.GetIDMessage(84151), self.znString],
[ARCPY.GetIDMessage(84152), self.pvString] ]
nnTable = REPORT.xmlTable(reportElement, rowVals,
title = ARCPY.GetIDMessage(84161))
#### Dataset Table ####
rowVals = [ [UTILS.addColon(ARCPY.GetIDMessage(84233)),
self.ssdo.inputFC],
[UTILS.addColon(ARCPY.GetIDMessage(84235)),
self.concept],
[UTILS.addColon(ARCPY.GetIDMessage(84241)),
LOCALE.format("%0.6f", self.studyArea)],
[UTILS.addColon(ARCPY.GetIDMessage(84418)),
str(self.ssdo.selectionSet)] ]
dTable = REPORT.xmlTable(reportElement, rowVals,
title = ARCPY.GetIDMessage(84239))
#### Create HTML ####
#.........这里部分代码省略.........
示例10: createOutputShapes
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import returnScratchName [as 别名]
def createOutputShapes(self, outputFC):
#### Shorthand Attributes ####
ssdoBase = self.ssdoBase
ssdoCand = self.ssdoCand
#### Validate Output Workspace ####
ARCPY.overwriteOutput = True
ERROR.checkOutputPath(outputFC)
#### Create Output Feature Class ####
ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84003))
outPath, outName = OS.path.split(outputFC)
tempFC = UTILS.returnScratchName("TempSS_FC", fileType = "FEATURECLASS",
scratchWS = outPath)
outTempPath, outTempName = OS.path.split(tempFC)
try:
DM.CreateFeatureclass(outTempPath, outTempName, ssdoBase.shapeType,
"", ssdoBase.mFlag,
ssdoBase.zFlag, ssdoBase.spatialRefString)
except:
ARCPY.AddIDMessage("ERROR", 210, outputFC)
raise SystemExit()
#### Add Null Value Flag ####
outIsShapeFile = UTILS.isShapeFile(outputFC)
setNullable = outIsShapeFile == False
#### Make Feature Layer and Select Result OIDs/Shapes ####
featureCount = ssdoBase.numObs + ssdoCand.numObs
ARCPY.SetProgressor("step", ARCPY.GetIDMessage(84003), 0,
featureCount, 1)
#### Add Shape/ID Field Names ####
matchID, candID = outputIDFieldNames
outFieldNames = ["[email protected]"] + outputIDFieldNames
inFieldNames = ["[email protected]", "[email protected]"]
UTILS.addEmptyField(tempFC, matchID, "LONG", nullable = True)
UTILS.addEmptyField(tempFC, candID, "LONG", nullable = True)
#### Add Append Fields ####
lenAppend = len(self.appendFields)
appendIsDate = []
in2OutFieldNames = {}
if lenAppend:
for fieldName in self.appendFields:
fcField = ssdoCand.allFields[fieldName]
fieldType = UTILS.convertType[fcField.type]
fieldOutName = UTILS.validQFieldName(fcField, outPath)
in2OutFieldNames[fieldName] = fieldOutName
if fieldType == "DATE":
appendIsDate.append(fieldName)
UTILS.addEmptyField(tempFC, fieldOutName, fieldType,
alias = fcField.alias)
outFieldNames.append(fieldOutName)
#### Add Analysis Fields ####
for fieldName in self.fieldNames:
fcField = ssdoBase.allFields[fieldName]
fieldType = UTILS.convertType[fcField.type]
fieldOutName = UTILS.validQFieldName(fcField, outPath)
in2OutFieldNames[fieldName] = fieldOutName
UTILS.addEmptyField(tempFC, fieldOutName, fieldType,
alias = fcField.alias)
outFieldNames.append(fieldOutName)
dataFieldNames = matchFieldInfo[self.similarType]
dataFieldInfo = outputFieldInfo[self.matchMethod]
baseValues = []
for fieldName in dataFieldNames:
outAlias, outType, baseValue = dataFieldInfo[fieldName]
UTILS.addEmptyField(tempFC, fieldName, outType,
alias = outAlias,
nullable = setNullable)
outFieldNames.append(fieldName)
baseValues.append(baseValue)
#### Get Insert Cursor ####
baseRows = DA.SearchCursor(ssdoBase.inputFC, inFieldNames)
candRows = DA.SearchCursor(ssdoCand.inputFC, inFieldNames)
rows = DA.InsertCursor(tempFC, outFieldNames)
#### Set Base Data ####
useShapeNull = outIsShapeFile
if useShapeNull:
nullIntValue = UTILS.shpFileNull['LONG']
else:
nullIntValue = None
#### Set Base Null For Append ####
appendNull = {}
for fieldName in self.appendFields:
if fieldName not in ssdoBase.fields:
if useShapeNull:
outType = ssdoCand.fields[fieldName].type
outNullValue = UTILS.shpFileNull[outType]
else:
outNullValue = None
appendNull[fieldName] = outNullValue
#.........这里部分代码省略.........