AnsweredAssumed Answered

RuntimeError: ERROR 010240 in Con operation in arcpy

Question asked by sharifulislamsium on Sep 9, 2016
Latest reply on Sep 17, 2016 by curtvprice

I am dabbling with the resolution of the error says RuntimeError: ERROR 010240: Could not save raster dataset to as attached as a screen shot. I am working with a DEM file and trying to generate raster based on the conditional values from an excel file. As the excel file has about 15000 row, I need to generate about 15000 raster. I am very much disappointed when the script takes long time and at last it fails every time at different point and this has been happening from the yesterday.

I am just reading date and associated 3 temperature values from the excel file and applying con operation on DEM arcgis grid raster to generate another raster. This process is repeated for all the dates i.e. rows in the excel file as attached.

My script is a below

# -*- coding: utf-8 -*-
import arcpy
import os
import sys
import shutil
from import Con
from import Raster
from openpyxl import load_workbook
arcpy.env.overwriteOutput = True

    r"C:\Users\Winrock\Desktop\Ryan\Sept02ModularApproach\Temperature Model Data.xlsx"  # arcpy.GetParameterAsText(0)

    r"C:\Users\Winrock\Desktop\Ryan\Sept02ModularApproach\DEM\dem_clip_11"  # arcpy.GetParameterAsText(1)
Second_Discrete_variable = 10  # arcpy.GetParameterAsText(2)

    r"C:\Users\Winrock\Desktop\Ryan\Sept02ModularApproach\OutputRaster"  # arcpy.GetParameterAsText(3)

    r"C:\Users\Winrock\Desktop\Ryan\Sept02ModularApproach\Temp"  # arcpy.GetParameterAsText(4)

Second_Discrete_variable = float(Second_Discrete_variable)
Temp_Data = []

# Loading temperature data

temp_wb = load_workbook(filename=INPUT_TEMP_EXCEL_PATH, read_only=True)
temp_ws = temp_wb[temp_wb.sheetnames[0]]
for row in temp_ws.rows:
    rw = [cell.value for cell in row]

Temp_Data = Temp_Data[1:]

# Folder content deleter

def folder_content_deleter(folder_path):
    for the_file in os.listdir(folder_path):
        file_path = os.path.join(folder_path, the_file)
            if os.path.isfile(file_path):
            elif os.path.isdir(file_path):
        except Exception, e:

# set temporary places, grid format needs a gdb for placing intermediate data

arcpy.env.workspace = arcpy.env.scratchWorkspace = \
    os.path.join(TEMP_FOLDER_PATH, 'ScratchData_solRaster.gdb')

# processing Second part

for tdata in Temp_Data:
    T1 = tdata[1]
    T2 = tdata[2]
    T3 = tdata[3]
    output_second = Con(Raster(INPUT_DEM_RASTER_PATH) < 2573, T1,
                        Con(Raster(INPUT_DEM_RASTER_PATH) <= 2754, T2,
    final_temp_raster = output_second + Second_Discrete_variable

        # save

    out_path = os.path.join(OUTPUT_TEMP_RASTER_FOLDER, str(tdata[0]))

# Cleaning

if arcpy.Exists('in_memory'):


My error in gist is-

RuntimeError: ERROR 010240: Could not save raster dataset to C:\Users\Winrock\Desktop\Ryan\Sept02ModularApproach\Temp\ScratchData_solRaster.gdb\ifthe_ras with output format FGDBR

The excel file I am using is


My error-



N.B. I tried several thread some of them are-

  1. What causes RuntimeError: ERROR 010240 saving after CellStatistics?
  2. Why does CON statement give ERROR 010240: Could not save raster dataset to (value) with output format GRID?
  3. error 010240 with output format grid
  4. arcgis 10.0 - python.multiprocessing and "FATAL ERROR (INFADI) MISSING DIRECTORY" - Geographic Information Systems Stack… 

System specification:









*I tried with different scratch and current workspace

*I tried with stops after processing almost 3000 rasters) and stops after processing almost 1070 rasters)

*I tried with arcpy.TestSchemaLock

*I tried with setting output to tif format too.


I see that it stops and raises error when it processed and output exact number of 1070 grid files.


It is giving me pain for several days- please help!