I'm working in Modelbuilder. I have a polygon in which I calculate the shape centroid in decimal coordinates (field called LONG_CENTR). Then I add a field (called FAJA) and I want to use a Field Calculator to assign it a value according to the centroid I've obtained previously. I think I have messed up the code in the field calculator.
Python-parser expression:
updateValue( !FAJA! )
Code Block:
def updateValue(FAJA) :
if (70.500 <= match.fabs(LONG_CENTR) and match.fabs(LONG_CENTR) <= 73.500):
return 1
elif (67.500 <= math.fabs(LONG_CENTR) and match.fabs(LONG_CENTR) < 70.500):
return 2
elif (64.500 <= math.fabs(LONG_CENTR) and match.fabs(LONG_CENTR) < 67.500): return 3
elif (61.500 <= math.fabs(LONG_CENTR) and match.fabs(LONG_CENTR) < 64.500):
return 4
elif (58.500 <= math.fabs(LONG_CENTR) and match.fabs(LONG_CENTR) < 61.500):
return 5
elif (55.500 <= math.fabs(LONG_CENTR) and match.fabs(LONG_CENTR) < 58.500):
return 6
elif (53.500 <= math.fabs(LONG_CENTR) and match.fabs(LONG_CENTR) < 55.500):
return 7
else:
return 0
The error I'm getting is:
ERROR 000539: Error running expression: replace( -69.256 )
Traceback (most recent call last):
File "<expression>", line 1, in <module>
File "<string>", line 2, in replace
NameError: global name 'match' is not defined
Failed to execute (Assign Faja Value).
What is causing this error?