arcpy.3d.Slice(in_raster, out_raster, {number_zones}, {slice_type}, {base_output_zone}, {nodata_to_value}, {class_interval_size})
|
名称
|
说明
|
数据类型
|
|
in_raster
|
要进行重分类的输入栅格。
|
Raster Layer
|
|
out_raster
|
输出重分类栅格。
输出将始终为整型。
除了标准 ObjectID、Value 和 Count 字段之外,输出栅格的属性表包含两个额外字段。 Value 字段表示类别值。 ZoneMin 和 ZoneMax 字段记录用于生成类别的最小和最大值。
|
Raster Dataset
|
|
number_zones
(可选)
|
输入栅格将重新分类为的区域数。
如果 slice_type 参数值为 EQUAL_AREA、EQUAL_INTERVAL、NATURAL_BREAKS 或 GEOMETRIC_INTERVAL,则此参数为必需项。
如果 slice_type 参数值为 STANDARD_DEVIATION_MEAN_CENTERED、STANDARD_DEVIATION_MEAN_BREAK 或 DEFINED_INTERVAL,则不支持 number_zones 参数。 输出区域数将由 class_interval_size 参数值确定。
|
Long
|
|
slice_type
(可选)
|
指定将输入栅格重新分类为区域的方式。
EQUAL_INTERVAL—The range of input values will be equally divided into the specified number of output zones to determine the class breaks. This is the default.
EQUAL_AREA—The number of input cells will be equally divided into the specified number of output zones to determine the class breaks. Each zone will have a similar number of cells, indicating a similar amount of area.
NATURAL_BREAKS—The class breaks will be determined in a way that minimizes the variance within classes and maximizes the variance between classes. The breaks are usually set at relatively big changes in the data values.
STANDARD_DEVIATION_MEAN_CENTERED—The class breaks will be placed above and below the mean value at a specified interval size, such as 2, 1, or 0.5, in the unit of standard deviation, until reaching the minimum and maximum values of the input raster. Mean is not used as a break but centered by two class breaks. One break is at half of the specified interval size above the mean and the other is at half of the specified interval size below the mean. Standard deviation is calculated with the n-1 denominator, where n is the number of pixels with value.
STANDARD_DEVIATION_MEAN_BREAK—The mean value will be used as a class break. Other class breaks will be placed above and below the mean value at a specified interval size, such as 2, 1, or 0.5, in the unit of standard deviation, until reaching the minimum and maximum values of the input raster. Standard deviation is calculated with the n-1 denominator, where n is the number of pixels with value.
DEFINED_INTERVAL—The class breaks will be set to zero and a multiple of the specified interval size relative to zero. They will then be clipped to the minimum and maximum values of the input data for the first and last classes. For a value range that contains zero, zero will always be included as a break point.
GEOMETRIC_INTERVAL—The class breaks will be created based on class intervals that have a geometric series. This is a pattern in which the current value equals the previous value divided by a geometric coefficient. The geometric coefficient in this classifier can change once (to its inverse) to optimize the class ranges. The algorithm creates these geometrical intervals by minimizing the sum of squares of the number of elements in each class. This ensures that each class has approximately the same number of values and that the change between intervals is consistent.
|
String
|
|
base_output_zone
(可选)
|
用于输出栅格数据集上的区域(类别)的起始值。
将为类别分配整数值,从起始值开始递增 1。
默认起始值为 1。
|
Long
|
|
nodata_to_value
(可选)
|
将输出中的 NoData 替换为值。
如果未设置此参数,则 NoData 像元将在输出栅格中保持为 NoData。
|
Long
|
|
class_interval_size
(可选)
|
类别之间的间隔大小。
当将 slice_type 参数设置为 DEFINED_INTERVAL、STANDARD_DEVIATION_MEAN_CENTERED 或 STANDARD_DEVIATION_MEAN_BREAK 时,此参数为必需项。
如果使用了 DEFINED_INTERVAL,则间隔大小表示用于计算类别间断点的实际值范围。
如果使用了 STANDARD_DEVIATION_MEAN_CENTERED 或 STANDARD_DEVIATION_MEAN_BREAK,则间隔大小表示用于计算类别间断点的标准差数。
|
Double
|
代码示例
基于数据固有的自然分组,将输入栅格重新分类为五个类别。
import arcpy
from arcpy import env
env.workspace = "C:/data"
arcpy.ddd.Slice("elevation", "c:/output/elev_slice.tif", 5, "NATURAL_BREAKS")
将输入栅格使用定义间隔 10 重新分类。
import arcpy
from arcpy import env
env.workspace = "C:/data"
arcpy.ddd.Slice("elevation", "c:/output/elev_slice_02.tif", "", "DEFINED_INTERVAL", "", "", 10)
基于数据固有的自然分组,将输入栅格重新分类为 10 个类别,并指定输出类别的起始值为 -5。
# Name: Slice_3d_Ex_03.py
# Description: Slices the input raster into 10 zones(classes) based on natural groupings inherent in the data
# Specify the starting value for output classes to be -5.
# Requirements: 3D Analyst extension
# Import system modules
import arcpy
from arcpy import env
# Set environment settings
env.workspace = "C:/data"
# Set local variables
inRaster = "elevation"
outRaster = "C:/output/elev_slice_03.tif"
numberZones = 10
baseOutputZone = -5
# Run Slice
arcpy.ddd.Slice(inRaster, outRaster, numberZones, "NATURAL_BREAKS", baseOutputZone)
将输入栅格重新分类为 10 个等面积类别。 将 NoData 像元分配为输出中的 -99 值。
# Name: Slice_3d_Ex_04.py
# Description: Slices the input raster into 10 zones(classes) based on equal area.
# Assign NoData cells to have a value of -99 in the output.
# Requirements: 3D Analyst extension
# Import system modules
import arcpy
from arcpy import env
# Set environment settings
env.workspace = "C:/data"
# Set local variables
inRaster = "elevation"
outRaster = "C:/output/elev_slice_04.tif"
numberZones = 10
baseOutputZone = 5
nodataToValue = -99
classIntervalSize = "" # or None
# Run Slice
arcpy.ddd.Slice(inRaster, outRaster, numberZones, "EQUAL_AREA", baseOutputZone, nodataToValue, classIntervalSize)