Hi all,
Apologies for what is probably a very simple question with an easy solution.
I am trying to populate a field of my attribute table using an if statement. Specifically, I have a field with vegetation types (1 - 10) but I want a new field where each of those values is assigned a name (i.e. forest cover). So If my cell value is 1, I want the new field to be assigned a value 'forest cover'. I've tried the following piece of code similar to previous answers but it is not working. Can anyone help me with a solution?
Thank you!
def customReplace(x):
if x=='1':
return 'ForestCover'
elif x=='2':
return 'ShrubCover'
elif x=='3':
return 'Grassland'
elif x=='4':
return 'Cropland'
elif x=='5':
return 'Floodland'
elif x=='6':
return 'SparseVeg'
elif VegType =='7':
return 'Bare'
elif x=='8':
return 'Built'
elif x=='10':
return 'Water'
else:
return "Not Found"