0

I have a table as like below:

enter image description here

I want to generate python script to calculate the value Low, Medium and High into a single layer.

I tried using this script:

Parser:
Python
Expression:
Reclass( Flood_Severity )
Code Block:
def Reclass ( Flood_Severity ):
 if ( FAT = 1 and FV = 1 and FD < 3):
 return "Low"
 elif ( FAT = 1 and FV = 1 and FD >= 3):
 return "Medium"
 elif ( FAT = 1 and FV = 2 and FD = 1):
 return "Low"
 elif ( FAT = 1 and FV = 2 and FD > 1 and FD < 4):
 return "Medium"
 elif ( FAT = 1 and FV = 2 and FD=4):
 return "High"

But it failed. May I know how to fix the script?

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Oct 4, 2021 at 7:59
3
  • 2
    Failed how? Do you get errors? Your table cant look like that in ArcMap, can you add a screenshot showing the attribute table Commented Oct 4, 2021 at 8:22
  • I agree with @BERA you need to edit your question and include an image of your data as it is in ArcMap. Commented Oct 4, 2021 at 13:18
  • Table shown cannot be analyzed. It looks like result of normal flat database table pivoted in Excel or similar. Commented Oct 4, 2021 at 18:40

1 Answer 1

3

You are going to get errors for using = as a comparison operator , it should be two ==.

See: Python Operators

And you need to include all the fields you use in the function, when declaring and calling it:

def Reclass ( FAT, FV, FD ):
 ...

And when you call it:

Reclass( !FAT!, !FV!, !FD! )
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
answered Oct 4, 2021 at 8:40

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.