Select to view content in your preferred language

How can I use Con in ArcGIS Pro?

1662
5
Jump to solution
09-07-2020 10:46 PM
YoshikiYamaguchi
New Contributor II

I am trying to implement Koppen's Climate classification on my map based on the amount of precipitation and temperature in US. The following is the criteria for B climate zones.

"70% or more of annual precipitation falls in the summer half of the year and r less than 20t + 280, or 70% or more of annual precipitation falls in the winter half of the year and r less than 20t, or neither half of the year has 70% or more of annual precipitation and r less than 20t + 140"

What I did was that I used a modelbuilder to calculate r less than 20t + 280, r less than 20t, and r less than 20t + 140, and then I tried to use Con tool to assign each one of these 3 if certain condition is true (70% or more of annual precipitation falls in the summer half of the year, 70% or more of annual precipitation falls in the winter half of the year , and else).

The picture below is my model. The one in the middle is where I did the calculation of 3 different values, and the one on the left if my Con expression for summer and the left one is my con expression for winter.

How can I do the "else" in Con tool? 

0 Kudos
1 Solution

Accepted Solutions
Robert_LeClair
Esri Notable Contributor

One idea that comes to mind is to use the Raster Calculator GP tool in your ModelBuilder.  In the Raster Calculator, create a nested CON statement as described in the following link here.

There is an example of three CON statements in a single statement:  OutRas = Con(InRas1 > 23, 5, Con(InRas1 > 20, 12, Con((InRas1 > 2) & (InRas1 < 17), Sin(InRas1), 100)))

Hope this helps!

View solution in original post

5 Replies
Robert_LeClair
Esri Notable Contributor

One idea that comes to mind is to use the Raster Calculator GP tool in your ModelBuilder.  In the Raster Calculator, create a nested CON statement as described in the following link here.

There is an example of three CON statements in a single statement:  OutRas = Con(InRas1 > 23, 5, Con(InRas1 > 20, 12, Con((InRas1 > 2) & (InRas1 < 17), Sin(InRas1), 100)))

Hope this helps!

YoshikiYamaguchi
New Contributor II

Thank you so much! This is what I needed.

I think I got it working finally!

0 Kudos
YoshikiYamaguchi
New Contributor II

OK My result is still not showing the value for when it is false. Can you help me see what I did wrong?

I have 2 expressions for when it is true and one for when it is false.

I want to return "Neithervalue" when it is false, but it is not displayed on my map.

 Con("%PRISM_ppt_30yr_normal_800mM2_annual_bil.bil%"*0.7 >=  "%PRISM_ppt_30yr_normal_800mM2_09_bil.bil%" + "%PRISM_ppt_30yr_normal_800mM2_08_bil.bil%" + "%PRISM_ppt_30yr_normal_800mM2_07_bil.bil%" + "%PRISM_ppt_30yr_normal_800mM2_06_bil.bil%" + "%PRISM_ppt_30yr_normal_800mM2_05_bil.bil%" + "%PRISM_ppt_30yr_normal_800mM2_04_bil.bil%" , "%Summervalue%",

Con("%PRISM_ppt_30yr_normal_800mM2_annual_bil.bil%" * 0.7 >= "%PRISM_ppt_30yr_normal_800mM2_03_bil.bil%" +"%PRISM_ppt_30yr_normal_800mM2_02_bil.bil%"  +"%PRISM_ppt_30yr_normal_800mM2_01_bil.bil%"  +"%PRISM_ppt_30yr_normal_800mM2_12_bil.bil%" +"%PRISM_ppt_30yr_normal_800mM2_11_bil.bil%" +"%PRISM_ppt_30yr_normal_800mM2_10_bil.bil%","%Wintervalue%",

"%Neithervalue%"))

0 Kudos
Robert_LeClair
Esri Notable Contributor

Would using the ModelBuilder If-Then-Else Logical tools work for your workflow?  You can find more about the various logical tools here.

YoshikiYamaguchi
New Contributor II

Thanks it  worked!