AnsweredAssumed Answered

Storing Rasters in an Array

Question asked by kev83 on Oct 11, 2013
Latest reply on Oct 22, 2013 by kev83
As I am new to this, please forgive me for any glaring errors.  I am trying to loop through a series of folders find the "wsgrid004" raster, clip it using a polygon, store the results in an array. Once all the rasters have been processed, mosaic them together.

All I get is a general syntax error, any help would be appreciated!

# Import modules import arcpy  # Set enviroment settings env.workspace = Input_Model  # Check out the ArcGIS Spatial Analyst extension license arcpy.CheckOutExtension("Spatial")  # Load Required Toolboxes arcpy.AddToolBox (r"C:\Program Files (x86)\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Data Management Tools.tbx")  #Enable the Overwriting of Existing GeoProcessing Results gp.overwrite = "True"  #Local Variables Count = 0 array = arcpy.Array() wse_grid = "wsgridp004 + Count" Folders = arcpy.ListWorspaces("*", "Folder")  # Argument 1 is the GeoRAS Directory Input_Model = arcpy.GetParameterAsText(0) # Argument 2 is the 100-Year Floodplain FP_Poly = arcpy.GetParameterAsText(1)  # Lists all folders in the Input_Model ListWorkspaces("*","Folder")  print "Looking for Sub-Directories" for Folder in Folders:     #Find the wsgridp004 Raster     print "Finding 100 YR WSEL Raster"     rasters = arcpy.ListRasters("wsgridp004", "Grid")                                               for "wsgridp004" in rasters:         Count = Count + 1         #Clip Raster with 100-Yr Floodplain Polygon         print "Clipping Raster"         arcpy.Clipmanagement("rasters", "#", "wse_grid", "FP_Poly", "0", "ClippingGeometry")         print arcpy.GetMessages()         array.add(wse_grid) #Mosaics Clipped 100-Yr Floodplain Grids print "Mosaicing Clipped Water Surface Grids" arcpy.MosaictoNewRaster_Management("", "Input_Model", "wse_100_Yr","NAD_1983_StatePlane_Texas_Central_FIPS_4203_Feet", "32_BIT_FLOAT", "3", "1", " ", " " ) print arcpy.GetMessages() print "Complete"