AnsweredAssumed Answered

Edit or calculate newly added field in a raster table based on cell values

Question asked by data.officer on Jun 20, 2017
Latest reply on Jun 20, 2017 by data.officer


I have a raster dataset with cell values from 1 to 21, corresponding to different land cover types. I have added a new text field called 'Habitat' to the attribute table and would like to fill this based on call values, i.e. Value = 1 means Broadleaved woodland, Value = 2 means Coniferous woodland etc. I am using ArcGIS Pro 1.4. 


At first I simply tried to double-click the cells in the new field and type in the new text manually, as I would with a vector dataset. This didn't work and I am presuming this functionality isn't available for rasters. 


Next, I turned to the Calculate Field and, after looking at previous threads about this topic, attempted the following (I only used the first two values out of 21 to test the code):


def Habitat(Value)
if (Value = "1"):
   Habitat = "Broadleaved woodland"
elif (Value = "2")
   Habitat = "Coniferous woodland"


For the expression I used Habitat = (!Value!). 


Upon verifying this I got the following error message: 



Where did I go wrong? Is there an easier way of editing a field in a raster attribute table? Thanks!