I have a point feature class with three elevation value fields (High; Medium; Low - calculated from a previous process), which I need to use as inputs in Raster Calculator, with the following expression: "DEM" <= Low elevation value in point FC above. This calculation needs to be repeated for each elevation value (i.e. High; Medium; Low). Question: How can I input these field values into the Raster Calculator in ModelBuilder? The Help File mentions using Variables, but I don't know how to do this! Any guidance will be gratefully received. Thanks very much.
Solved! Go to Solution.
Mark, the Raster Calculator expression being reported in the dialog is:
""w1dem <= "100""
You can't directly compare a grid with a string in arcpy map algebra... based the screenshot of your model I'm guessing the expression you are using is something like
w1dem <= Value
So it looks like your output of Get Field Value is coming out as a string not float. The way to fix that is to modify your expression like this:
w1dem <= Float(Value)
or set the output data type parameter of Get Field Value to Double instead of Any value. You may need to do both. I'm not at work to try it.
Worth a try anyway!
did you read through the examples in modelbuilder advanced techniques particularly the section on variable substitution and the use of lists?
HI Dan, I went through the help file and applied the Variable process as best as I understood it but I have not managed to get it right - see below:
I have also attached a PDF. I cannot seem to get Raster Calculator to read the value it needs to run in the formula.
Any help would be greatly appreciated.
Kind regards,
Mark
Mark, the Raster Calculator expression being reported in the dialog is:
""w1dem <= "100""
You can't directly compare a grid with a string in arcpy map algebra... based the screenshot of your model I'm guessing the expression you are using is something like
w1dem <= Value
So it looks like your output of Get Field Value is coming out as a string not float. The way to fix that is to modify your expression like this:
w1dem <= Float(Value)
or set the output data type parameter of Get Field Value to Double instead of Any value. You may need to do both. I'm not at work to try it.
Worth a try anyway!
Hi Curtis, Thanks so much - you are a star. Your suggestions worked! I made the output type Double, and added the Float parameter. It did not work initially, but then I saw that there were still " " quotes around the Value parameter in the expression. Once I removed those it all ran! Thanks again for your input.