Select to view content in your preferred language

Saving results from Int used on a raster (ERROR 010240)

744
1
10-12-2021 08:52 AM
AnnaPearson
Occasional Contributor

I'm trying convert a raster from float to integers (see code and resulting error below). I've tried making env.workspace and env.scratchWorkspace the same/making them different/changing what geodatabases I'm saving to, and outputting the raster as different types of raster datasets (FGDBR, GRID, TIFF). The path works when running with other functions and I've verified that the float raster dataset works normally. It also works without any errors when running Int as a tool instead of in python. 

import arcpy

from arcpy import env

from arcpy.sa import *

env.workspace = env.scratchWorkspace= path+"\\OnlineVisuals.gdb"

in_raster=Raster(path+"\\Grids.gdb\\"+x)
out_raster=Int(in_raster)
out_raster.save(path+"\\OnlineVisuals.gdb\\"+x+"I")

RuntimeError: ERROR 010240: Could not save raster dataset to r3241300I with output format FGDBR.

 I think the problem may be that when it runs Int on the raster it's creating a .afr file in a temp folder instead of paying attention to the set workspace (printing out_raster shows it's creating a file in the temp folder below), but I can't figure out how to change that? Thanks for any ideas/insight!

\Temp\ArcGISProTemp38044\xa29dca8c_ce7c_4863_99bf_3a4d30cb1f75y0.afr

1 Reply
MartinPorteš
Occasional Contributor

Hi, did you figure this problem out? 

I'm using arcpy.Sa.Plus function on two rasters and I have exactly the same problem with saving the raster. 

Martin

0 Kudos