Clip a raster and change cell size?

502
1
05-03-2013 09:37 AM
RalphHaugerud
New Contributor
I'm trying to script the clipping of a large raster into tiles with simultaneous resampling. A script that includes these lines:

[INDENT]print 'Clipping to '+clipExtent
print arcpy.Describe(sourceGrid+'/Band_1').meanCellWidth
arcpy.env.cellSize = 1.0
print arcpy.env.cellSize
arcpy.Clip_management(sourceGrid,clipExtent,clippedGrid)
print arcpy.Describe(clippedGrid+'/Band_1').meanCellWidth
            [/INDENT]

gives the following output (annotated):
[INDENT]Clipping to 230000 3970000 240000 3980000
0.5      (sourceGrid cell size)
1        (arcpy.env.cellSize}
0.5      (clippedGrid cell size)[/INDENT]

Why does Clip_management appear not to honor the arcpy.env.cellSize setting? What am I not understanding?
0 Kudos
1 Reply
DavidMartin
Occasional Contributor II
This is simply because the Clip_Management tool doesn't honour the Cell Size Environment setting. To see which Environment settings are honoured by a tool, check the "Environments" section near the bottom of any tool's Help page. For Clip_Management, you can see that Cell Size is not included in this section:

http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000009n000000

To change the cell size, you would therefore need to use the Resample tool:

http://resources.arcgis.com/en/help/main/10.1/index.html#/Resample/00170000009t000000/

... where you can specify Cell Size as one of the parameters.
0 Kudos