I have the problem that the ArcGIS Field Calculator doesn't read a float number when it is included in Python by referring to the field that contains it, in this way:
def giveResult(floatValue): if floatValue>0: a=(1000,5000,10000,15000,20000) for i in range(len(a)): if a[i]/1000>floatValue: return a[i] break else: return 3 else: return 0
This code returns only the values 3 and 0, because the line
doesn't work properly. The problem seems to be my European Windows localization settings, where decimals are displayed with commas instead of points. These settings are applied to float fields in ArcGIS. It seems that Field Calculator interprets these floats as tuples because of the comma.
How can this data be handled?
I finally have it, in this way: checking which is the variable type in each case, and only if the type is tuple, we catch the first part (it's enough to build the function); we don't mind if the variable isn't tuple (don't need to catch that condition).
Only that part of the code would be:
for i in range(len(a)): if type(OFEhu)==tuple: OFEhu=OFEhu if (a[i]/1000)>OFEhu: return a[i]