Raster Compare (Data Management)
Summary
Compares the properties of two raster datasets, two raster catalogs, or two mosaic dataset and then returns the comparison result.
Usage
-
The tool returns messages showing the comparison result.
-
The parameter and attribute tolerances allow your comparisons to have a specified amount of leeway.
For Python syntax, you will need to open the tool dialog to view a list of values for the Ignore Options parameter. Your Compare Type will determine which Ignore Options are valid.
Syntax
Parameter | Explanation | Data Type |
in_base_raster |
The input raster that will be compared to the test raster. Valid inputs include a raster dataset, a raster catalog or a mosaic dataset. | Raster Layer; Raster Catalog Layer; Mosaic Layer |
in_test_raster |
The test raster that will be compared to the input base raster. Valid inputs include a raster dataset, a raster catalog or a mosaic dataset. | Raster Layer; Raster Catalog Layer; Mosaic Layer |
compare_type (Optional) |
The type of comparison.
| String |
ignore_option [ignore_option,...] (Optional) |
The properties specified will not be compared during comparison. Open the tool dialog to view a list of values for the Ignore Options parameter. Your Compare Type will determine which Ignore Options are valid. | String |
continue_compare (Optional) |
Indicates whether to compare all properties after encountering the first mismatch.
| Boolean |
out_compare_file (Optional) |
The name and path of the text file which will contain the comparison results. | File |
parameter_tolerances [[Parameter, Tolerance, Type],...] (Optional) | The Parameter Tolerance allows you to compare your parameter values with some leeway on accuracy. This allows you to account for any slight changes that might have occurred in processing your data. For a list of Parameter types, choose the parameters for which you would like to have a tolerance. For each parameter you will need a tolerance and tolerance type. The tolerance type is either the value of the tolerance or a fraction of it. When using the fraction type, the fraction is based on the base value; therefore, the tolerance value for comparison would be the fraction times the base value. For example, if your base value is 100 and you set the fraction tolerance to 0.00001, the compare tolerance will be 100 * 0.00001 = 0.001
| Value Table |
attribute_tolerances [[Field, Tolerance],...] (Optional) |
The Attribute Tolerance allows you to compare your attribute values with some leeway on accuracy. This allows you to account for any slight changes that might have occurred in processing your data. Type the field name and tolerance value for each parameter for which you want to have a tolerance. The tolerance value is the actual value of the tolerance, not a fraction. | Value Table |
omit_field [omit_field,...] (Optional) |
These are the fields you would like to Omit in the comparison results. Type in the fields to omit in the comparison. When dealing with a raster catalog scenario, you are comparing attribute columns of the raster catalogs, not any attributes within the catalog items. | String |
Code Sample
This is a Python sample for RasterCompare.
import arcpy
RasterCompare_management("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")
This is a Python sample for RasterCompare.
##====================================
##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.RasterCompare_management("raster_base.tif","raster_test.tif","RASTER_DATASET",\
"","CONTINUE_COMPARE","compareresult.txt","","","")
##Compare two Raster Catalog with ignore options
arcpy.RasterCompare_management("fgdb.gdb/rc_base","fgdb.gdb/rc_test","RASTER_CATALOG",\
"IsManaged;Extent","CONTINUE_COMPARE","compareresult2.txt",\
"","","DATE")
##Compare two Mosaic Dataset with torelance
arcpy.RasterCompare_management("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()