I am experiencing a painful problem in the middle of a Python script I am writing. When I get to a Map Algebra function, I have tried two different options and both return a different error.
At first I wrote:
facteur_Pente = Con((surf_Drainee > 12) & (surf_Drainee <= 80) & (pente_Rclass <= 24),pente_Rclass + 1, Con((surf_Drainee > 80) & (pente_Rclass < 24),pente_Rclass + 2,Con((surf_Drainee > 80) & (pente_Rclass == 24),pente_Rclass + 1,pente_Rclass)))
The error I get from this is: "TypeError: cannot concatenate 'str' and 'int' objects"
This seems normal, as I have strings (surf_Drainee, pente_Rclass) so I convert the values to str using the following:
facteur_Pente = Con(("surf_Drainee" > str(12)) & ("surf_Drainee" <= str(80)) & ("pente_Rclass" <= str(24)),"pente_Rclass" + str(1), Con(("surf_Drainee" > str(80)) & ("pente_Rclass" < str(24)),"pente_Rclass" + str(2),Con(("surf_Drainee" > str(80)) & ("pente_Rclass" == str(24)),"pente_Rclass" + str(1),"pente_Rclass")))
The problem is that it doesn't work, and produces the following error: "RuntimeError: ERROR 000732: Input Raster: Dataset pente_Rclass1 does not exist or is not supported."
I don't even have a pente_Rclass1 in my script!
Does anybody know how I could fix this problem in order to continue my script?