Skip To Content

How the combinatorial math tools work

Available with Spatial Analyst license.

Available with Image Analyst license.

The combinatorial math tools assign new output values to unique combinations of input values. How the uniqueness of the combination is determined depends on which particular combinatorial tool is used. There are three tools for performing combinatorial logical operations: Combinatorial And, Combinatorial Or, and Combinatorial XOr.

Conceptually, the general process of the combinatorial algorithm is as follows:

  1. NoData cells are not considered in the analysis, so cells that are NoData in either input will be NoData in the output raster.

  2. The remaining cells for both inputs are scanned through sequentially from left-to-right and top-to-bottom. An internal table tracks whenever a unique combination of input values is encountered.

  3. Once all the unique combinations of input values are determined, the logical condition for the particular tool is applied.

    • For Combinatorial And, the True condition is where both inputs are a value other than 0.
    • For Combinatorial Or, the True condition is where one or both of the inputs are not 0.
    • For Combinatorial XOr, the True condition is where one of the inputs is 0 and the other is a value other than 0.

  4. The output will be generated based on the logical condition.

    The False condition will return a value of 0. Each unique True condition will be returned as a sequential number from the first one encountered.

  5. In the attribute table of the output raster, two items are added that show the cell values from the input rasters that compose the unique combinations. This can be considered the parentage.

Example

Consider the input rasters shown in the Illustrations for the combinatorial tools. They show two rasters of 16 cells (4x4), with values ranging from 0 to 4, and some cells as NoData. To facilitate this discussion, the input cell values will be listed sequentially here in a vertical list.

  1. NoData cells excluded:

    Since NoData is not considered, the first step is to ignore those cells in the input.

  2. Unique Combinations:

    The remaining cells in the inputs are scanned through sequentially from left-to-right and top-to-bottom, and unique combinations are recorded.

    Input Values     =>   NoData Excluded   =>   Unique Combinations
    ==============        ===============        ======================
    InRas1  InRas2        InRas1  InRas2         InRas1  InRas2   Count
    ------  ------        ------  ------         ------  ------   -----
      1       0             1       0              1        0     ( 2 )
      1       1             1       1              1        1     ( 2 )
      0       1             0       1              0        1     ( 1 )
      0       0             0       0              0        0     ( 3 )
    nodata    3             1       3              1        3     ( 1 )
      1       3             2       1              2        1     ( 1 )
      2       1             2       2              2        2     ( 2 )
      2       2             0       0              4        3     ( 1 )
      4     nodata          0       0              0        2     ( 1 )
      0       0             2       2 
      0       0             4       3  
      2       2             0       2  
      4       3             1       1  
      0       2             1       0
      1       1          
      1       0      
    
  3. True/False State:

    Once the unique combinations of input values are determined, the logical True/False condition for the particular tool is applied.

  4. Returned Value:

    The False conditions for each of the tools will return a value of 0. Each unique True condition will return the sequential number of that condition.

    Combinations     =>   True/False State  =>   Returned Value 
    ==============        ================       =============== 
    InRas1  InRas2        And   Or    XOr        And   Or    XOr
    ------  ------        ---   ---   ---        ---   ---   ---
      1       0            F     T     T          0     1     1
      1       1            T     T     F          1     2     0
      0       1            F     T     T          0     3     2
      0       0            F     F     F          0     0     0
      1       3            T     T     F          2     4     0
      2       1            T     T     F          3     5     0
      2       2            T     T     F          4     6     0
      4       3            T     T     F          5     7     0
      0       2            F     T     T          0     8     3
    
  5. The attribute table of the output raster is appended with the values of the input rasters that defined the unique condition. Examples of this can be seen in the Illustration section of the reference help for the combinatorial tools.

Related topics


In this topic
  1. Example