The following code isn't working as expected and I'm not sure why:
UpOrDown = reclass(!UpOrDown!)
def reclass (Z,GP):
if (GP == "DT" and Z == "CG"):
UpOrDown = 1
if (GP == "DT" and Z == "CN"):
UpOrDown = 1
if (GP == ...and so on.... )
The expression is passing as valid but the wrning (warning 002858) suggests that there is a TypeError
in reclass()
which is missing the argument 'G'
.
I have added this into the code at UpOrDown = reclass(!UpOrDown!,!G!)
which returns no error but doesn't output the expected variable of 1 in the UpOrDown
column (which is Double).
I also changed the dependent variables to both Z and GP which still didn't change anything.
What is missing?
reclass(!UpOrDown!)
and two in the arglistdef reclass (Z,GP)
and you don't show what is returned. Look again at the documentation. 1) same number of arguments, 2)return
a singleton valuereturn UpOrDown
.elif
in your conditional logic (orreturn 1
instead of not returning the set variable)