Select to view content in your preferred language

Raster Calculator Input

4308
4
Jump to solution
10-23-2014 12:14 PM
MarkNorris-Rogers
Emerging Contributor

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.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
curtvprice
MVP Esteemed Contributor

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!

View solution in original post

0 Kudos
4 Replies
DanPatterson_Retired
MVP Emeritus

did you read through the examples in modelbuilder advanced techniques      particularly the section on variable substitution and the use of lists?

0 Kudos
MarkNorris-Rogers
Emerging Contributor

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:

Model_Error.png

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

0 Kudos
curtvprice
MVP Esteemed Contributor

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!

0 Kudos
MarkNorris-Rogers
Emerging Contributor

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.

0 Kudos