AnsweredAssumed Answered

Reclassify a field in model builder

Question asked by merebears on Nov 25, 2013
Latest reply on Nov 26, 2013 by merebears
I have a fairly large model with a field in the table labeled RETURN_PER for types of flooding (2yr, 5yr, 10yr, 25yr, 50yr, 100yr, 200yr, 500yr etc.)  However the field needs to show these values as percents (50pct, 20pct, 10pct, 04pct etc.)  I need to make the change at the end of the model but am having a hard time getting the field to change values.  So far my thought process has gone Add Field -> Calculate Field (New field equals original field) -> Calculate Field (Recalculate Original field adding Reclassify script [see below] to show percentages)  -> Delete New Field.

def Reclass(variable1):
  if variable1 == "2":
    return "50pct"
  if variable1 == "5":
    return "20pct"
  if variable1 == "10":
    return "10pct"
  if variable1 == "25":
    return "04pct"
  if variable1 == "50":
    return "02pct"
  if variable1 == "100":
    return "01pct"
  if variable1 == "200":
    return "0_5pct"
  if variable1 == "500":
    return "0_2pct"

Any other suggestions would be greatly appreciated.

Thanks

Outcomes