arcpy.management.RasterCompare(in_base_raster, in_test_raster, {compare_type}, {ignore_option}, {continue_compare}, {out_compare_file}, {parameter_tolerances}, {attribute_tolerances}, {omit_field}, {out_compare_raster})
|
名称
|
说明
|
数据类型
|
|
in_base_raster
|
将与 in_test_raster 参数值进行比较的栅格或镶嵌数据集。 此参数值是您已声明为有效的数据。 此基础数据包含正确的内容和信息。
|
Raster Layer; Mosaic Layer
|
|
in_test_raster
|
将与 in_base_raster 参数值进行比较的栅格或镶嵌数据集。 此参数值是因编辑或编译新信息而进行更改的数据。
|
Raster Layer; Mosaic Layer
|
|
compare_type
(可选)
|
指定将比较的栅格类型。
RASTER_DATASET—将比较两个栅格数据集。
GDB_RASTER_DATASET—将比较地理数据库中的两个栅格数据集。
MOSAIC_DATASET—将比较两个镶嵌数据集。
|
String
|
|
ignore_option
[ignore_option,...]
(可选)
|
指定将在比较中被忽略的属性。
BandCount—将忽略波段数。
Extent—将忽略范围。
Columns And Rows—将忽略列和行数。
Pixel Type—将忽略像素类型。
NoData—将忽略 NoData 值。
Spatial Reference—将忽略空间参考系统。
Pixel Value—将忽略像素值。
Colormap—将忽略色彩映射表。
Raster Attribute Table—将忽略属性表。
Statistics—将忽略统计数据。
Metadata—将忽略元数据。
Pyramids Exist—将忽略已有的金字塔。
Compression Type—将忽略压缩类型。
Data Source Type—将忽略数据源类型。
|
String
|
|
continue_compare
(可选)
|
指定在找到输入之间的第一个差异后,是否继续比较。
|
Boolean
|
|
out_compare_file
(可选)
|
该输出文件将包含输入之间的所有异同点。 该文件是一个以逗号分隔的文本文件,在 ArcGIS 中可以表的形式对其进行查看和使用。
|
File
|
|
parameter_tolerances
[[Parameter, Tolerance, Type],...]
(可选)
|
落在此容差范围内的值视作相同。 可以对所有参数使用相同的容差,也可以向各个参数应用不同的容差。
容差类型可以为值,也可以为分数。
如果容差类型是分数,则每个像素的容差将不同,因为每个像素具有不同的值。 例如,如果容差分数设置为 0.5,则容差计算如下:
值表列:
Parameter—There are seven types of parameter tolerances you can adjust.
All—The extents, pixel values, minimums, maximums, means, and standard deviations will be compared to determine if they are equal within the specified tolerance.
Extent—If the difference of the extents is within the tolerance, they will be considered equal.
Pixel_Value—If the difference of the pixel values is within the tolerance, they will be considered equal.
Statistics_Minimum—If the difference of the minimum values is within the tolerance, they will be considered equal.
Statistics_Maximum—If the difference of the maximum values is within the tolerance, they will be considered equal.
Statistics_Mean—If the difference of the mean values is within the tolerance, they will be considered equal.
Statistics_Standard_Deviation—If the difference of the standard deviations is within the tolerance, they will be considered equal.
Tolerance—Set the tolerance type to a specified value or use that value as a fraction.
Type—Set the type of tolerance value for the selected parameter.
|
Value Table
|
|
attribute_tolerances
[[Field, {Tolerance}],...]
(可选)
|
在该数值范围内的属性值将被视作相同。 此参数仅适用于数值字段类型。
值表列:
Field—The numeric field that the tolerance will be applied to.
Tolerance—The numeric value that determines the range in which attribute values are considered equal. This only applies to numeric field types.
|
Value Table
|
|
omit_field
[omit_field,...]
(可选)
|
在比较过程中将被忽略的一个或多个字段。 这些字段的字段定义和表格值将被忽略。
|
String
|
|
out_compare_raster
(可选)
|
输出栅格包含 in_base_raster 和 in_test_raster 参数值之间的差异。
|
Raster Dataset
|
派生输出
|
名称
|
说明
|
数据类型
|
|
compare_status
|
未找到差异时,比较状态将为 'true',找到差异时,比较状态将为 'false'。
|
Boolean
|
代码示例
RasterCompare 示例 1(Python 窗口)
这是 RasterCompare 函数的 Python 示例。
import arcpy
arcpy.management.RasterCompare("C:/workspace/image1.tif","C:/workspace/image2.tif",
"RASTER_DATASET","'Pyramids Exist'",
"CONTINUE_COMPARE","C:/workspace/compare01.txt",
"Pixel_Value 1 Value","Count 5","OID")
这是 RasterCompare 函数的 Python 示例。
##====================================
##Raster Compare
##Usage: RasterCompare_management in_base_raster in_test_raster {RASTER_DATASET |
## GDB_RASTER_DATASET | GDB_RASTER_CATALOG |
## MOSAIC_DATASET} {ignore_option;ignore_option...}
## {NO_CONTINUE_COMPARE | CONTINUE_COMPARE}
## {out_compare_file} {Parameter {Tolerance} {Type};
## Parameter {Tolerance} {Type}...} {Field {Tolerance};
## Field {Tolerance}...} {omit_field;omit_field...}
try:
import arcpy
arcpy.env.workspace = "c:/workspace"
##Compare two Raster dataset
arcpy.management.RasterCompare("raster_base.tif","raster_test.tif","RASTER_DATASET",
"","CONTINUE_COMPARE","compareresult.txt","","","")
##Compare two Raster Catalog with ignore options
arcpy.management.RasterCompare("fgdb.gdb/rc_base","fgdb.gdb/rc_test","RASTER_CATALOG",
"IsManaged;Extent","CONTINUE_COMPARE","compareresult2.txt",
"","","DATE")
##Compare two Mosaic Dataset with torelance
arcpy.management.RasterCompare("fgdb.gdb/md_base","fgdb.gdb/md_test","MOSAIC_DATASET",
"IsEmbedded;Seamline","CONTINUE_COMPARE","compareresult3.txt",
"All 0.00001 Fraction","HighPS 0.0001;LowPS 0.0001",
"ItemTS;UriHash")
except:
print("Raster Compare exsample failed.")
print(arcpy.GetMessages())