Original User: ddombroskiHello, fairly new to python and arcpy scripting here. I have a script where I'm iteratively (within a loop) creating raster tiles from numpy arrays. As I create them, I would like to build a single larger raster that will contain all the tiles after the loop has finished (presumably a mosaic). The arcpy.Mosaic_management function is failing with errors that I cannot figure out. Here is the bulk portion of the code:# Create empty raster for tiles to go into
ghsi_rast = arcpy.CreateRasterDataset_management(rast_dir,ghsi_out,"5","32_BIT_FLOAT","","1","","","","","")
#ghsi_rast = arcpy.CreateRasterDataset_management(rast_dir,ghsi_out)
for r in range(0,nrows,tile_size[0]):
row_end = min([nrows,r+tile_size[0]-1])
row_step = row_end-r+1
for c in range(0,ncols,tile_size[1]):
# determine indices for the tile to be processed
col_end = min([ncols,c+tile_size[1]-1])
col_step = col_end-c+1
# convert each tile from the Raster to a numpy arry for processing
dep_subarray = arcpy.RasterToNumPyArray(dep_rast,arcpy.Point(r,c),row_step,col_step,nodata_to_value=noDataValue)
vel_subarray = arcpy.RasterToNumPyArray(vel_rast,arcpy.Point(r,c),row_step,col_step,nodata_to_value=noDataValue)
# create a mask of the nodata values (to be used before converting back to raster)
mask = ma.masked_where(vel_subarray==noDataValue,vel_subarray)
mask = mask.mask
# interpolate HSI values to depth and velocity arrays
vhsi_subarray = np.interp(vel_subarray,vel,vel_hsi)
dhsi_subarray = np.interp(dep_subarray,dep,dep_hsi)
# apply mask to VHSI & DHSI arrays
vhsi_subarray = ma.array(vhsi_subarray,mask=mask)
dhsi_subarray = ma.array(dhsi_subarray,mask=mask)
# calculate global HSI
ghsi_subarray = np.sqrt(vhsi_subarray * dhsi_subarray)
# convert global HSI back to raster and add tile to larger raster
ghsi_subrast = arcpy.NumPyArrayToRaster(ghsi_subarray,arcpy.Point(r,c),cell_size)
arcpy.Mosaic_management(ghsi_subrast,ghsi_rast,"","","",noDataValue,"","","")
Here's the error I seem to be getting:arcpy.Mosaic_management(ghsi_subrast,ghsi_rast,"","","",noDataValue,"","","")
File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 7168, in Mosaic
raise e
ExecuteError: ERROR 999999: Error executing function.
Failed to rename raster dataset
Failed to execute (Mosaic).
Thoughts on where I've gone wrong? Thanks