I have 3 fields:

  1. "ISL_Numero" - Long (values are '1', '2', '3', '4' etc.)
  2. "Subtipo_IS" - Text (values are 'A', 'B', 'C' etc.)
  3. "Ambiente_C" - Text (values I want to calculate)

An example of what I want:

If "ISL_Numero" is 1 and "Subtipo_IS" is A, I want "Ambiente_C" to be Mangue

If "ISL_Numero" is 1 and "Subtipo_IS" is B, I want "Ambiente_C" to be Praia

If "ISL_Numero" is 2 and "Subtipo_IS" is A, I want "Ambiente_C" to be Cascalho

And so on ...

I tried the following:

def Reclass(ISLNumero,SubtipoIS):
    if ( ISL_Numero == 1 and Subtipo_IS == "A" ) :
        return "Mangue"
    elif ( ISL_Numero == 1 and Subtipo_IS == "B" ) :
        return "Praia"
    elif ( ISL_Numero == 2 and Subtipo_IS == "A" ) :
        return "Cascalho"
        return ""

The calculation runs with no errors but the "Ambiente_C" doesn't get calculated as expected, it remains blank.

  • 3
    the variable name in the if does not match the parameter name (ISLNumero vs ISL_Numero , and SubtipoIS vs Subtipo_IS)
    – JGH
    Jan 20, 2020 at 16:44

1 Answer 1


I'm not familiar with Python in ArcGIS specifically, but, as @JGH noted in their comment, the variables in your function definition (ISLNumero and SubtipoIS) must correspond to the names you use in the function body (ISL_Numero and Subtipo_IS). If there's some kind of error log in ArcGIS, I would expect to see a NameError: name 'ISL_Numero' is not defined from Python.

If the issue persists, as always, please provide additional details and we'll do our best to help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.