This is my first attempt at converting Python from 9.3 to 10.0, and I'm having problems using the raster objects with map algebra. I can create a raster object using Raster('pathname'), but any further use of the raster object in map-algebra expressions doesn't seem to work.
Here is a simplified example, from my Python Idle window. My typing is in column 1, output is indented. When the output is 'None", then the expression didn't work properly. Also, when the output is 'None', if I try to save the raster object using rasobj.save('path'), then I get an error message.
import arcpy arcpy.SetProduct('ArcInfo') u'CheckedOut' from arcpy import env from arcpy.sa import * arcpy.CheckOutExtension('spatial') u'CheckedOut' env.workspace = 'c:/workspace' InRas = 'slope_deg' InRasObj = Raster(InRas) print InRasObj.maximum 80.2379150391 Deg2Rad = math.pi / 180. print Deg2Rad 0.0174532925199 r1 = InRasObj * Deg2Rad print r1.maximum None r1 = Raster(InRas) * Deg2Rad print.maximum 1.40041577816 r2 = Tan(r1) print r2.maximum None r2 = Tan(InRasObj * Deg2Rad) print r2.maximum None r2 = Tan(Raster(InRas) * Deg2Rad) print r2.maximum 5.81231069565
I can only use map-algebra expressions successfully if I don't use any raster objects to the right of the equals sign.
I have a lot of 9.3 programs to convert to 10, and I was looking forward to using the simplified map algebra instead of the old SOMA. It's slow going, so far.
Thanks in advance, Tim.L