SamYosemite

Field Calculator Reclass Python

Discussion created by SamYosemite on Aug 30, 2012
Latest reply on Aug 30, 2012 by SamYosemite
I'm trying to assign a float value to field N_Value, based on the string value in field LUCode.  My code runs without errors, but isn't making any changes in the attribute table.

def Reclass(N_Value, LUCode):
  if LUCode == "Pasture":
    return 0.050
  elif LUCode == "Greenspace":
    return 0.04
  elif LUCode == "Forest":
    return 0.08
  elif LUCode == "Urban":
    return 0.04
  elif LUCode == "Brush":
    return 0.060
  elif LUCode == "Grass":
    return 0.035
  elif LUCode == "Clean, straight":
    return 0.030
  elif LUCode == "Clean, straight":
    return 0.035
  elif LUCode == "Straight, weeds/stones":
    return 0.040
  else:
    print "Done."


Reclass(!N_Value!, !LUCode!)


Thank you.

Outcomes