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

Syntax

RasterCompare_management (in_base_raster, in_test_raster, {compare_type}, {ignore_option}, {continue_compare}, {out_compare_file}, {parameter_tolerances}, {attribute_tolerances}, {omit_field})
ParameterExplanationData 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.

  • RASTER_DATASETCompares raster dataset properties.
  • GDB_RASTER_DATASETCompares properties of raster datasets in a geodatabase.
  • GDB_RASTER_CATALOGCompares properties of raster catalogs in a geodatabase.
  • MOSAIC_DATASETCompares properties of mosaic datasets.
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.

  • NO_CONTINUE_COMPAREStop after encountering the first mismatch. This is the default.
  • CONTINUE_COMPARECompare other 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

  • AllThis option will apply the same tolerance to the extent, pixel value, minimum pixel value, maximum pixel value, mean pixel value, and standard deviation pixel value.
  • ExtentThe extent of the raster will have an allowable tolerance.
  • Pixel_ValueThe pixel values of the raster will have an allowable tolerance.
  • Statistics_MinimumThe minimum pixel value of the raster will have an allowable tolerance.
  • Statistics_MaximumThe maximum pixel value of the raster will have an allowable tolerance.
  • Statistics_MeanThe mean pixel value of the raster will have an allowable tolerance.
  • Statistics_Standard_DeviationThe standard deviation pixel value of the raster will have an allowable tolerance.
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

RasterCompare example 1 (Python window)

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")
RasterCompare example 2 (stand-alone script)

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()

Environments

Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes

10/27/2014