Use conditional processing

Discussion created by bagardne on Mar 3, 2013
I am currently working through the 9.3 spatial analyst tutorial, but I am using 10.1. Many times I have been able to work through the inconsistencies between the two versions. I have reached a wall with the Con function. Here is the exercise:

Step 3  Define the potential reservoir
The reservoir will be a subset of cells within the dam???s basin because cells not in the basin flow away from the dam. To define the reservoir, you???ll write a Map Algebra expression that selects cells inside the basin whose elevation is less than the proposed height of the dam, which is 790 meters.

Here???s where CON will come in handy. Its syntax is:

CON(<condition>, <true_expression>, {false_expression})

Any expression that evaluates to true or false (or non-zero and zero) may be supplied as the condition argument. If the condition evaluates to true, then the true expression is evaluated. If the condition is false, then the false expression evaluates.

These expressions may be simple, like a single value or raster, or complex expressions made up of multiple nested functions???including other CON functions. If the optional false expression is left blank and the condition evaluates to false, then CON returns NoData.

Note: In the Conditional toolset, there is a Con tool available that performs the CON operation. However, this tool allows only one input layer. Since you have two input layers, you will use the Single Output Map Algebra tool.

From the Map Algebra toolbox, open the Single Output Map Algebra tool and enter the following Map Algebra expression:

CON([DamBasin] AND ([DamElev] <= 790), 790)

This CON statement translates as "If the cell is inside the basin and its elevation is less than or equal to 790 meters, then return a value of 790; else return NoData."

For the part about "inside the basin," recall that Map Algebra considers any non-zero, non-NoData value to be a logical true. By omitting the last CON argument (the False case), you are setting cells that don't pass the test to NoData.

The raster calculator will not accept any similar ways I have tried to execute the program. Thank you for any assistance you can provide.