Select to view content in your preferred language

Raster Calculator trouble

7781
17
03-15-2011 12:42 PM
RolandoLopez1
Emerging Contributor
hello everyone, i dont know if anyone is familiarized with spatial analyst courses from ESRI but right now im trying to make some exersises that were made for arcgis 9.3 like making a raster from a selection (this is in the second chapter) ussing raster.field worked in earlier versions but now i dont know how to do it to  get the same results as in the earlier version (i almost solved this by using the extract by atribute but not with the same results and the questioning continues...  have someone tryied to make this excersices with the arcgis 10.?
0 Kudos
17 Replies
EricRice
Esri Regular Contributor
The Lookup tool only supports integer output. Does anyone have a workaround for floating point data in another field?


Greg,
The Lookup tool is not limited to integer output.  I just created a field of type Float, and populated it with floating point values.  When I use this field in the Lookup tool, I get a floating point raster as output.  Is it possible you have floating point values stored in a text field? 

The documentation for the Lookup tool does state, "The output will always be of integer type".  This is wrong, and I've notified the appropriate team so they can change that sentence in the doc.

Regards,
Eric
0 Kudos
NishaKrishnan
New Contributor
I, too, have a similar problem as stated in this thread. I tried using the lookup function on my raster, but it keeps erroring out and gives me the following error:[ATTACH=CONFIG]22969[/ATTACH]

I would ideally like to export the MinMax field (the last field) into its own separate raster or is there an easier way to use the minmax field in calculations with other floating point rasters?

Thanks!
0 Kudos
curtvprice
MVP Alum
I, too, have a similar problem as stated in this thread. I tried using the lookup function on my raster


Some ideas:

- Set the workspace and default workspace to the same location, copy your raster to that same workspace, and try running Lookup again.   This is generally best practice when working with raster tools, as the conversion of temporary to permanent rasters only requires a rename, not copying the whole raster.

- It's also just generally safer to have the Lookup operate within the same workspace, as there are joins at work.

- Make sure your environment (cell size, mask, or extent) aren't interfering with your processing.
0 Kudos
curtvprice
MVP Alum
what happens if i have to make a add opperation like the one i mentioned earlier e.  soil.Ph + vegetation.Ph can i do this on the calculator or do i have to make more steps?


I didn't see a direct answer to this in the thread, so here's how you do that in one step using the Raster Calculator tool in ArcMap:
("soil" and "vegetation" are two raster layers, both with a raster table field "ph")

Lookup("soil","ph") + Lookup("vegetation","ph")


In arcpy scripting, you may have to access the rasters by pathname. Here's how that works:

from arcpy.sa import *
arcpy.env.workspace = "D:/myfolder" 
# "soil.img" and "vegetation.img" are in this folder
# the Raster function is used to convert the path strings to a raster object
phsum = Lookup(Raster("soil.img"),"Ph") + Lookup(Raster("vegetation.img"),"ph")
phsum.save("phgrid") # save to Esri grid D:\myfolder\phgrid
0 Kudos
DianeMcConnaughey
Deactivated User
"Lookup" usually fails in raster calculator, even when I run the same process from "results".   Here is the process I'm trying to run in raster calculator.  If it worked, I'd like to string together the 10 rasters I am working with.
lookup("veg2_p34_Weiser","veggie_minus_Tall")
Can I use lookup to mosaic rasters?  The reason I do not want to use mosaic, is that cannot specify the item to use in mosaic ( or at least I have not found the sytax), and I'm getting frustrated having to create new GRIDs with the value from the item I want to use
0 Kudos
curtvprice
MVP Alum
"Lookup" usually fails in raster calculator


I hope this question is not unwarranted, but are you always capitalizing the name of the "Lookup" tool? Tool names are case-sensitive in ArcGIS 10's Raster Calculator and arcpy.

If you create a raster with the Create Raster Dataset tool, you can use Mosaic in arcpy map algebra with Lookup like this:

Mosaic([Lookup("grid1","FIELD1"), Lookup("grid2","FIELD2")], "mergeraster")
0 Kudos
DianeMcConnaughey
Deactivated User
I've completed what I need to do for the time being, but will try your suggestion when things slow down, it would definitely be more efficient than the step-by-step approach I ended up using.  I was trying these operations  both in Windows  10.0 SP4  with data on    the network and in windows 10.1 (Sp?) with data on the local hard drive.  The 10.1 usually worked, while 10.0 usually failed.  10.0    also failed to load tables into a newly created FGDB table - both directly from GRIDs and from ascii output from those GRIDs - it just   did not "see" them.  10.1 worked.   In raster calculator it would be nice to be able to chose the "Lookup" function (and other functions)  so that "case" is not an issue, as well as being able to select the "item" to use in the lookup.
0 Kudos
curtvprice
MVP Alum
.   In raster calculator it would be nice to be able to chose the "Lookup" function (and other functions)  so that "case" is not an issue, as well as being able to select the "item" to use in the lookup.


You may want to try just entering map algebra in the python window in ArcMap instead of Raster Calculator. This supports fixing capitalization etc. For example, try this in the ArcMap Python window with some raster layers in your map

>>> from arcpy.sa import *
>>> ras = Con


You'll see popups that guide  you through entering the map algebra.

Desktop 10.1 Help: Comparing Map Algebra between ArcGIS 9.x and 10
0 Kudos