CEEn 414 - Civil Engineering Applications of GIS |
HOW CON WORKSTo understand a Con expression, you must first break it into smaller components. For example, in the expression
the argument 'ingrid1 > 5' is the <condition>, '100' is the <true_expression> and '50' is the <false_expression>. The logic underlying the expression is that if the value of ingrid1 is greater than 5, then assign 100 to the output grid, and if the value of ingrid1 is 5 or less, then assign 50 to the output grid. A more complex example is an embedded Con function within another Con function:
Here, the <condition> for the first Con is 'ingrid1 >= 20'. The <true_expression> is another Con function: con(ingrid1< 50, 40, 100). The <true_expression> of the embedded Con is '40' and the <false_expression> is '100'. The <false_expression> of the first Con is '200'. The logic of the expression follows: if the value on ingrid1 is greater than or equal to 20 but less than 50, assign 40 to the output grid. If the value on ingrid1 is greater than 50, assign 100 to the output grid. If the value of ingrid1 is less than 20, assign 200 to the output grid. |