Select to view content in your preferred language

raster.save gives RuntimeError: ERROR 010240

808
2
Jump to solution
09-02-2023 12:40 AM
Labels (1)
TadeášDěd
Occasional Contributor

Hi, 

I am running simple code:

from arcpy.sa import Raster
arcpy.CheckOutExtension("Spatial")
print("Creating delta_t_veg raster...")
d2 = Raster(D2_VEG)  # Replace with the actual path to your raster
d1 = Raster(D1_VEG)  # Replace with the actual path to your raster
delta_t = d2 - d1
scratch_save_path = f"delta_t_veg_new "
delta_t.save(scratch_save_path)

 

and it returns an error:
RuntimeError: ERROR 010240: Could not save raster dataset to delta_t_veg_new with output format FGDBR.

When I first save the raster to tif and then trying to upload it to gdb with 

arcpy.CopyRaster_management(scratch_save_path, final_save_path)
 
I get:
arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds. General function failure No spatial reference exists. Failed to execute (CopyRaster).
 
 

I have double-checked paths, I have tried shorter paths for gdb, the workspace is set to my gdb, and delta_t is legit (I can save it to .tif to disk).  

Can someone help? It seems like a path issue, are raster tools sensitive to paths on Windows? When running raster calculator in ArcGIS Desktop it is working. When running above code in notebook, it is not....

0 Kudos
1 Solution

Accepted Solutions
TadeášDěd
Occasional Contributor

Hi, 

after further investigation, the problem was caused by underscore in the name of save raster. I.e. changing 
scratch_save_path = f"delta_t_veg_new" to scratch_save_path = f"deltaTVegNew" solved the issue. 🙂 

I think this is a kind of bug, which should be fixed ...


Thank you!
TD

View solution in original post

0 Kudos
2 Replies
TadeášDěd
Occasional Contributor

I have further tried to investigate and when I move my .tif file way up in working directory CopyRaster function is working:

arcpy.CopyRaster_management(r"c:\scratch\delta_t_veg_temp.tif", r"c:\clip.gdb\xxx")
 
Is there any way to overcome this issue? I am creating a Python tool that should be part of the ArcGIS Desktop project and will be run on different machines by different users. 
 
Thank you!
Best from 
Tadeas
0 Kudos
TadeášDěd
Occasional Contributor

Hi, 

after further investigation, the problem was caused by underscore in the name of save raster. I.e. changing 
scratch_save_path = f"delta_t_veg_new" to scratch_save_path = f"deltaTVegNew" solved the issue. 🙂 

I think this is a kind of bug, which should be fixed ...


Thank you!
TD

0 Kudos