I am trying to populate a field [Hazard] based on the values in two other fields [Depth2D] and [Speed2D].
I have managed to write a code block in VB script that works but I really want to figure out how to write it in Python. I cannot seem to get it right.
Underneath is the current iteration of my attempt at python, from what I have seen I need to define the variables to use, but can't seem to define things right.
The VB Script code block is as follows -
Dim hazard If [DEPTH2D]<0.1 Then hazard = 1 elseif [DEPTH2D]>=0.1 AND [DEPTH2D]<0.2 AND [SPEED2D]<2 Then hazard = 2 else hazard = 3 end if
The Python code block I have tried is as follows
def ifBlock(depth2d,speed2d) if: depth2d < 0.1 return 1 elif: depth2d >=0.1 AND depth2d <0.2 AND speed2d<2 return 2 else: return 3
I then have
in the formula box
The error I am getting in the results window is ERROR999999; Syntax Error