AnsweredAssumed Answered

Faster way to automate this?

Question asked by branninc_analyze on Sep 30, 2014
Latest reply on Oct 1, 2014 by branninc_analyze

Hello

 

Here is a simple script that places rasters into a catalog then mosaics them. I can't help but feel I am doing this in a less than optimal manner. So, I am wondering if there is a faster way to run this or if I should just be patient with current speeds? Thanks for any help and suggestions!

 

import arcpy
from arcpy import env

ws = r"C:/test"
rc = r"C:/H/H.gdb/DEM_Tiles"
try:
    for dirpath, dirnames, filenames in arcpy.da.Walk(ws, datatype="RasterDataset", type="ALL"):
        for filename in filenames:
            addRaster = arcpy.WorkspaceToRasterCatalog_management(ws, rc, "INCLUDE_SUBDIRECTORIES", "NONE")
            print "adding:", filename


except:
    print "Workspace to raster catalog failed"
    print arcpy.GetMessages()


try:
    print "Setting up mosaic for tiles..."
    arcpy.RasterCatalogToRasterDataset_management(r"C:H.gdb/DEM_Tiles", r"C:/H.gdb/Mosaic", "", "FIRST", "FIRST", "", "", "8_BIT_UNSIGNED", "NONE", "NONE", "", "")


except:
    print "raster mosaic failed"
    print arcpy.GetMessages()

Outcomes