Oh, one other thing I found was that in v9.3, using the gp.snapraster environment slowed down many of the Spatial Analyst functions (some by more than just a few seconds). So in my case 2 sec x 50,000 = 28 hours. My solution was to write my own "snapraster" function that would alter the gp.extent setting. Using my function (as opposed to gp.snapraster) I experienced no gp.snapraster-related slowdown...def snapExtentToRaster(inputExtent, snapRaster):
"Returns a xMin, yMin, xMax, yMax extent snapped to the cell allignment of a raster"
xMinInput = float(inputExtent.split(" ")[0])
yMinInput = float(inputExtent.split(" ")[1])
xMaxInput = float(inputExtent.split(" ")[2])
yMaxInput = float(inputExtent.split(" ")[3])
dscSnapRaster = gp.describe(snapRaster)
cellSize = float(dscSnapRaster.meancellheight)
xMinSnap = float(dscSnapRaster.extent.xmin)
yMinSnap = float(dscSnapRaster.extent.ymin)
xMaxSnap = float(dscSnapRaster.extent.xmax)
yMaxSnap = float(dscSnapRaster.extent.ymax)
#Calculates a modified xMinInput
if xMinSnap < xMinInput:
if divmod(abs(xMinInput - xMinSnap), cellSize)[1] / cellSize < .5:
xMinOutput = xMinSnap + divmod(abs(xMinInput - xMinSnap), cellSize)[0] * cellSize
else:
xMinOutput = xMinSnap + cellSize + divmod(abs(xMinInput - xMinSnap), cellSize)[0] * cellSize
else:
if divmod(abs(xMinInput - xMinSnap), cellSize)[1] / cellSize < .5:
xMinOutput = xMinSnap - divmod(abs(xMinInput - xMinSnap), cellSize)[0] * cellSize
else:
xMinOutput = xMinSnap - cellSize - divmod(abs(xMinInput - xMinSnap), cellSize)[0] * cellSize
#Calculates a modified yMinInput
if yMinSnap < yMinInput:
if divmod(abs(yMinInput - yMinSnap), cellSize)[1] / cellSize < .5:
yMinOutput = yMinSnap + divmod(abs(yMinInput - yMinSnap), cellSize)[0] * cellSize
else:
yMinOutput = yMinSnap + cellSize + divmod(abs(yMinInput - yMinSnap), cellSize)[0] * cellSize
else:
if divmod(abs(yMinInput - yMinSnap), cellSize)[1] / cellSize < .5:
yMinOutput = yMinSnap - divmod(abs(yMinInput - yMinSnap), cellSize)[0] * cellSize
else:
yMinOutput = yMinSnap - cellSize - divmod(abs(yMinInput - yMinSnap), cellSize)[0] * cellSize
#Calculates a modified xMaxInput
if xMaxSnap < xMaxInput:
if divmod(abs(xMaxInput - xMaxSnap), cellSize)[1] / cellSize < .5:
xMaxOutput = xMaxSnap + divmod(abs(xMaxInput - xMaxSnap), cellSize)[0] * cellSize
else:
xMaxOutput = xMaxSnap + cellSize + divmod(abs(xMaxInput - xMaxSnap), cellSize)[0] * cellSize
else:
if divmod(abs(xMaxInput - xMaxSnap), cellSize)[1] / cellSize < .5:
xMaxOutput = xMaxSnap - divmod(abs(xMaxInput - xMaxSnap), cellSize)[0] * cellSize
else:
xMaxOutput = xMaxSnap - cellSize - divmod(abs(xMaxInput - xMaxSnap), cellSize)[0] * cellSize
#Calculates a modified yMaxInput
if yMaxSnap < yMaxInput:
if divmod(abs(yMaxInput - yMaxSnap), cellSize)[1] / cellSize < .5:
yMaxOutput = yMaxSnap + divmod(abs(yMaxInput - yMaxSnap), cellSize)[0] * cellSize
else:
yMaxOutput = yMaxSnap + cellSize + divmod(abs(yMaxInput - yMaxSnap), cellSize)[0] * cellSize
else:
if divmod(abs(yMaxInput - yMaxSnap), cellSize)[1] / cellSize < .5:
yMaxOutput = yMaxSnap - divmod(abs(yMaxInput - yMaxSnap), cellSize)[0] * cellSize
else:
yMaxOutput = yMaxSnap - cellSize - divmod(abs(yMaxInput - yMaxSnap), cellSize)[0] * cellSize
#Returns the entire modified extent
return str(xMinOutput) + " " + str(yMinOutput) + " " + str(xMaxOutput) + " " + str(yMaxOutput)
#Set the gp.extent to that of the nestIdsBufferFC = nestId and use snapExtentToRaster() function to set the snapraster instead of gp.snapraster (which slows things down)
gp.extent = ""
tempExtentML = "in_memory\\temp_extent"
gp.Select_analysis(nestIdsBufferFC, tempExtentML, "NEST_ID = " + str(nestId))
gp.extent = tempExtentML
gp.extent = snapExtentToRaster(gp.extent, habGrd)