本文整理汇总了Python中SSUtilities.chunk方法的典型用法代码示例。如果您正苦于以下问题:Python SSUtilities.chunk方法的具体用法?Python SSUtilities.chunk怎么用?Python SSUtilities.chunk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SSUtilities
的用法示例。
在下文中一共展示了SSUtilities.chunk方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: network2SWM
# 需要导入模块: import SSUtilities [as 别名]
# 或者: from SSUtilities import chunk [as 别名]
#.........这里部分代码省略.........
#### Add Destinations ####
ARCPY.SetProgressor("default", ARCPY.GetIDMessage(84133))
masterToken = "Name " + masterField + " #;"
masterToken += masterField + " " + masterField + " #"
NET.AddLocations(ODCostMatrix, naClassNames["Destinations"], inputFC, masterToken,
searchTolerance, exclude_restricted_elements = "EXCLUDE")
#### Initialize Spatial Weights Matrix File ####
hierarchyBool = hierarchy == 'USE_HIERARCHY'
addConcept = WU.wTypeDispatch[fixed].split("_")[0]
forceFixed = (fixed == True)
swmWriter = WU.SWMWriter(swmFile, masterField, netSpatName,
numObs, rowStandard,
inputFC = inputFC, wType = 10,
inputNet = inputNetwork,
impedanceField = impedance,
barrierFC = inputBarrier,
uturnPolicy = uturnPolicy,
restrictions = restrictions,
useHierarchy = hierarchyBool,
searchTolerance = searchTolerance,
addConcept = addConcept,
exponent = exponent,
forceFixed = forceFixed)
#### Create FieldList for Subset Searching ####
totalImpedance = "Total_" + impedance
fieldList = ";".join( ["NAME", totalImpedance] )
#### Get Chunks if Necessary ####
numOrigins = int(10000000. / numObs)
allMaster.sort()
chunkedIDs = UTILS.chunk(allMaster, numOrigins)
sqlStrings = UTILS.sqlChunkStrings(inputFC, masterField, chunkedIDs)
numChunks = len(sqlStrings)
#### Create Field Map for Origins ####
masterToken = "Name " + masterField + " #"
orgFieldMap = [masterToken, 'CurbApproach CurbApproach 0',
'SourceID SourceID #', 'SourceOID SourceOID #',
'PosAlong PosAlong #', 'SideOfEdge SideOfEdge #']
orgFieldMap = ";".join(orgFieldMap)
#### Keep Track of Features That Snap to Network ####
snappedFeatures = set([])
for chunkNum in xrange(numChunks):
progMsg = ARCPY.GetIDMessage(84145).format(chunkNum + 1, numChunks)
ARCPY.SetProgressor("default", progMsg)
#### Make Origins from Chunk of Destinations ####
sqlValue = sqlStrings[chunkNum]
DM.MakeFeatureLayer(destinationLayer, destFCLayer, sqlValue)
NET.AddLocations(ODCostMatrix, naClassNames["Origins"], destFCLayer, orgFieldMap,
"#", "#", "#", "#", "CLEAR")
#### Solve OD Matrix and Select Data ####
NET.Solve(ODCostMatrix, "SKIP")
#### Count the Number of NonZero Spatial Linkages ####
numLinks = UTILS.getCount(lines)
#### Create Search Cursor for OD Line Info ####
rows = ARCPY.SearchCursor(lines, "", None, fieldList)
row = rows.next()