I am trying to calculate a new field in ArcGIS 10.5 Desktop using the field calculator, based on the value in any or all of three other fields in the same table. I have not used Python for a while, and am forgetting how to do this.
In essence, this should calculate if any of three types of a crop are being grown in an area. If at least one has an area greater than 1 hectare, then it should return "1" (if two or three types are present, it should give the same answer). The input fields and criteria:
- Dry season rice > 1 hectare
- Wet season rice > 1 hectare
- Upland rice > 1 hectare
- If any of these are true, then return "1" to new field I have already created, otherwise, new field is 0.
I have tried a few options in Python, but none have worked so far, e.g.:
def calc(Dry_area_1,Wet_area_1,Up_rice_1): if Dry_Rice > 1: Grow_Rice = 1 elif Wet_Rice > 1: Grow_Rice = 1 elif Up_Rice > 1: Grow_Rice = 1 else return 0
Am I overlooking something very simple at a late hour of the night here?
ifblocks, it's important to inspect for differences. Only one block uses
return, which should indicate that you have a missing