I am trying to find the sum of a list of rasters using Cell Statistics in ArcPy. I am getting the following message: 'ERROR 000864: Overlay statistic: The input is not within the defined domain.'

I know this has something to do with not correctly coding the part where myrasters is input into the Cell Statistics function, but I can't figure out how to fix it. The function requires a list of rasters.

ESRI's sample code for this function is:

outCellStatistics = CellStatistics([inRaster01, inRaster02, inRaster03], "SUM", "NODATA")

Instead of writing out the whole list of rasters one by one for this function, I'm trying to get it to work with the myrasters list as an input.

Here's what I've got:

import arcpy
from arcpy import env 
from arcpy.sa import *
import os

myrasters = arcpy.ListRasters('*.tif')
outraster = arcpy.gp.CellStatistics_sa([myrasters], "SUM", "DATA")

UPDATE: Switching to arcpy.gp.CellStatistics_sa(myrasters, "SUM", "DATA") as suggested by user2856 produces the same error. My list of rasters is structured as follows:


produces the output:

[u'raster1.tif', u'raster2.tif', u'raster3.tif', u'raster4.tif']
<type 'list'>
<type 'unicode'>

2 Answers 2


You are passing a nested list - a "list of lists". myrasters is already a list (['raster1.tif', 'raster2.tif', etc...]) then you wrap it in another list.

CellStatistics expects a list of rasters, so when it accessed the 1st element of your list and that element was a list not a raster, it raised an exception.


outraster = arcpy.gp.CellStatistics_sa([myrasters], "SUM", "DATA")


outraster = arcpy.gp.CellStatistics_sa(myrasters, "SUM", "DATA")
  • I tried the suggested change and it still produces the same error. I'm not sure why it doesn't like my list of rasters.
    – Mon Mo
    Commented Sep 27, 2019 at 20:05

User2856's answer correctly addressed the core issue. The other issue that was causing the error to persist was subtle differences in the Cell Statistics function. Apparently running ArcPy within ArcMap requires different syntax than standalone Python. The way it finally worked was:

outraster = CellStatistics(myrasters, "SUM", "DATA")

and not:

outraster = arcpy.gp.CellStatistics_sa(myrasters, "SUM", "DATA")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.