Clip converts my 16bit unsigned data to 32 bit - bug ?

1864
2
04-05-2011 11:28 PM
MichaelStjernholm
New Contributor III
Hi

I'm processing a huge bunch of large images. A part of the operation is to use Clip_management to cut-out a part of the image using a vector feature. Unfortunately Clip always produce a 32-bit unsigned int despite the input is 16-bit unsigned int. I use tiff as output  format and have tried to set the compression to both "NONE" and LZ77" without any luck

How can I force 16-bit output without having to use the processing costly route of:
arcpy.CreateRasterDataset_management(path, filename,PixSiz,pixelType.get(str(ValueType),"16_BIT_UNSIGNED"),outputSR, nBands)
followed by
arcpy.Mosaic_management operation - which beside adding an extra processing step also become quite computing intensive as you can't prohibit pyramids building when having images larger than your screen size or similar !

The problem seems specifically related to the "Clipping with geometry", which I need to use as I :
a) neeed to reduce size to minimu
b) later need to calculate the histogram for a specific area using BuildRasterAttributeTable.

The help does include a warning "If Clipping Geometry is used, then the pixel depth of the output may be promoted. " - But it is not clear when and why the change happens


Is it in reality a bug seen by others ? I run win7 on 64-bit, Arc 10 SP1

All ideas are welcomed

Michael
Tags (2)
0 Kudos
2 Replies
MichaelStjernholm
New Contributor III
i've now found that there most probably is an error in the Clip routine, which by the way also migrate into "Extract by mask" !

My data contained the value of 0 and had a NoData value assigned to 65536.
I could fortunately in this case consider my value of 0 as NoData, and thus circumvent the problem by using
    arcpy.Clip_management(inName,"#",outRaster,maskLYR,"0","ClippingGeometry")
rather than
    arcpy.Clip_management(inName,"#",outRaster,maskLYR,"","ClippingGeometry")

regards

Michael
0 Kudos
MelanieSummers
Occasional Contributor III
Hi Michael,

Please take a look at this KB article:

FAQ:  Why does the data bit depth increase when a raster is projected, rotated, or clipped?
http://support.esri.com/en/knowledgebase/techarticles/detail/28470

If your raster contains values that range from 0 to 65535, ArcMap may assign the raster a NoData value of 65536 pushing the bit requirement up to 32.

If your data does not span the entire 0 to 65535 you can specify a no data value within the range allowing ArcMap to output a 16 bit raster.

Best,

Melanie
0 Kudos