Python script for if/else branching statement to use in modelbuilder

357
1
09-24-2018 04:03 AM
Tabitha_NjeriKaranja
New Contributor II

Hi all,

I have a model where I would like to perform further geoprocessing, if it fits a certain condition. To be more specific, I have dataset which i put through the CON tool and the output is either 0, 1. Thereafter, I perform ZONAL STATISTICS whose output, I DIVIDE out from the original dataset. When the output of the divide tool, if it is greater than 90% to go back to the output of the CON tool and "reclassify"* the 0 to 1 such that I only have 1 in the whole dataset. If the output of the divide tool is less than 90%, no further processing is needed. I have attached a screenshot of the model. 

I checked the website Branching: Implementing if-then-else logic for IF/ELSE statement  as a starting point but I have no skills in python and thus need help in making the script. The other website checked Using If-Then-Else logic for branching—Help | ArcGIS Desktop, the examples open out to the ArcGIS blog and have no further helpful information that I have found.

I am using ArcGIS 10.6 and have Spatial Analyst extension.

PS: "reclassify"- am not sure if this is the right tool to use but i used it for better explanation.

0 Kudos
1 Reply
Tabitha_NjeriKaranja
New Contributor II

Hi guys,

I looked at the problem again and used other tools in modelbuilder such as GET FIELD VALUE and CALCULATE VALUE to get the results I needed.