频数示例 3(独立脚本)
以下独立脚本演示了如何使用多个地理处理脚本函数(包括 Frequency 函数)。
# Description: Break all multipart features into single part features,
# and generate a report of which features were separated.
# Import system modules
import arcpy
# Create variables for the input and output feature classes
inFeatureClass = "c:/data/gdb.gdb/vegetation"
outFeatureClass = "c:/data/gdb.gdb/vegetation_singlepart"
try:
# Create list of all fields in inFeatureClass
fieldNameList = [field.name for field in arcpy.ListFields(inFeatureClass)]
# Add a field to the input this will be used as a unique identifier
arcpy.AddField_management(inFeatureClass, "tmpUID", "double")
# Determine what the name of the Object ID is
OIDFieldName = arcpy.Describe(inFeatureClass).OIDFieldName
# Calculate the tmpUID to t