mattiasvo

calculations on rasters stored in memory

Discussion created by mattiasvo on Jan 18, 2012
Latest reply on Jan 26, 2012 by mattiasvo
Hi everyone,

I want to write a program, in which I do calculations on several rasters.  In the program, I use some rasters that I calculated earlier in (the same) program. The problem is now that this doesn't seem to work.
The program crashes and in my geodatabase a 'timesras, ifthe_ras,... are found after the crash.
Here follows a small piece of code with the same logic as what I do in my program, what do I do wrong here? I hope I don't have to save each raster (here: a and b) before I can use them in a new calculation? Are there other sollutions?



Kind Regards,
Mattias

import arcpy
from arcpy import *
from arcpy.sa import *

env.workspace = "C:/..."
arcpy.CheckOutExtension("Spatial")

InRas1 = Raster('C:/...')
InRas2 = Raster('C:/...')

a = InRas1*InRas2
b = InRas1/InRas2

OutRas = a*b
OutRas.save('C:/...')

Outcomes