Mosaictonewraster after aggregating rasters

03-12-2020 05:44 AM
New Contributor II

I am trying to aggregate three rasters and then use mosaictonewraster to create a unified raster. I have run this using point and click in Arcgis 10.7.1  but when I run it in python it is unable to locate the aggregated rasters. Here is the core code

outaggreg_t2 = Aggregate(file_tile2, cellFactor, "SUM", "TRUNCATE", "NODATA")
 outaggreg_t3 = Aggregate(file_tile3, cellFactor, "SUM", "TRUNCATE", "NODATA")
 outaggreg_t6 = Aggregate(file_tile6, cellFactor, "SUM", "TRUNCATE", "NODATA")
 #Create New Raster
 print newtile
 arcpy.MosaicToNewRaster_management("outaggreg_t2;outaggreg_t3;outaggreg_t6","F:/VIIRS unzipped/scratch", newtile, "","32_BIT_FLOAT", "", "1", "LAST","FIRST")

I get the error message 

ExecuteError: ERROR 000999: Failed to get raster. Please check if the input parameters is correct.
Failed to execute (MosaicToNewRaster)

I know the easy solution to this is to save each of the outaggreg* files as explicitly and then call the latter files. Is that necessary,  or is there something else that I am doing incorrectly?

0 Kudos
1 Reply
MVP Legendary Contributor

cell size should be a float and I wouldn't leave it unspecified even though it is optiona.

the number bands an integer (long), you have it as text

Mosaic To New Raster—Data Management toolbox | Documentation 

0 Kudos