[GIS] Use field calculator to reclassify values from three different fields to populate a new field AND determine overlap with different raster

arcgis-10.2arcgis-desktopfield-calculatorpythonraster

I want to reclassify values of 3 different fields AND determine if one of those fields is located inside a different polygon to populate the values of my new field. Everything is raster.

I created a new field (WScore) that I want to populate with numeric values (double) based on the values of 3 different fields – Age_Databa, Riparian_S, and SITE_PHY.

My parameters:

If Age_Databa is 200 or >200 and Riparian_S is not 1 (any number but 1), then WScore should = 5

If Age_Databa is >200 and Riparian_S = 1, then WScore should = 2

If SITE_PHY is <70 and it is in a hydric soil polygon (a raster in my gdb), then WScore = 4

Before realizing the last part about the needing SITE_PHY to be inside the hydric soil polygon, this is what I started with. Pretty sure my syntax is wrong. Any help would be fantastic.

def Reclass(Soils):
global out
 if (Age_Databa <= 200) and (Riparian_S > 1 or Riparian_S < 1):
  out 5
 elif (Age_Databa <= 200) and (Riparian_S == 1):
  out 2

Best Answer

Try

def Reclass(Age_Databa,Riparian_S):
  if Age_Databa <= 200 and Riparian_S != 1:
    out = 5
  elif Age_Databa > 200 and Riparian_S == 1:
    out = 2
  return out

You'll need to expand that for your third condition.

I suspect you should be looking at the reclassify tool.

Related Question