I am trying to write a python script to batch Aggregate a bunch of different rasters. I get a Parsing Error Syntax error for line 11.
# Batch Aggregate raster tool
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = r"C:\rasters"
out_workspace = r"C:\rasters\agg"
rasters = arcpy.ListRasters()
for raster in rasters
outAggreg = Aggregate(raster, 10, "MEAN")
outAggreg.save(out_workspace, raster + "_agg")
lambertj
3,1224 gold badges22 silver badges39 bronze badges
asked Jul 13, 2013 at 20:23
1 Answer 1
Try the following changes:
# Batch Aggregate raster tool
import arcpy, os
from arcpy import env
from arcpy.sa import *
env.workspace = r"C:\rasters"
out_workspace = r"C:\rasters\agg"
rasters = arcpy.ListRasters()
for raster in rasters:
outAggreg = Aggregate(raster, 10, "MEAN")
outAggreg.save(os.path.join(out_workspace, raster + "_agg.tif"))
answered Jul 13, 2013 at 20:34
-
It ran, but this time I get an error: RuntimeError: ERROR 010093: Output raster format UNKNOWN is unsupported. The input raster is an ECW and aggregate can't output that - it can output TIFFs though.detroit_hc– detroit_hc2013年07月13日 20:40:18 +00:00Commented Jul 13, 2013 at 20:40
-
1Try adding the .tif extension to the output path.2013年07月13日 20:51:41 +00:00Commented Jul 13, 2013 at 20:51
-
1Bingo. out_workspace, raster + "_agg.tif" Thanks for the help!detroit_hc– detroit_hc2013年07月13日 20:54:06 +00:00Commented Jul 13, 2013 at 20:54
lang-py
rasters
.