Copy Raster to adjust pixel depth doesn't work

5058
4
Jump to solution
01-07-2016 08:46 AM
johnpolo
New Contributor III

I made a four rasters in Raster Calculator with plans to mosaic them to one raster. One of the four resulted in an 8 bit unsigned pixel type. The others are 16 bit signed. I can't mosaic these rasters and I am guessing the different pixel type is the reason. I did check the projection, which is usually my problem, but that is not the problem. 

The calculator script was

(<raster_#> * 100) + raster_b

The 8 bit raster came from a raster_# that had 3 values while the other raster_# had four values in the grid and I am guessing that this is causing the different pixel type in the results. I saw this thread​ and so I tried Copy Raster(Data Management) with the 8 bit result by setting the optional Pixel Type to 16 bit signed, but that still resulted in an 8 bit pixel depth. How can I get these rasters into one mosaic?

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

There is also the possibility that some of the rasters contained no data values and got promoted to the next level, ... assuming they occupied the full range

Bit depth capacity for raster dataset cells

What were the exact settings you used in Copy Raster

View solution in original post

4 Replies
DanPatterson_Retired
MVP Emeritus

There is also the possibility that some of the rasters contained no data values and got promoted to the next level, ... assuming they occupied the full range

Bit depth capacity for raster dataset cells

What were the exact settings you used in Copy Raster

johnpolo
New Contributor III

The rasters' NoData Values:

raster_1 (8 bit unsigned): 255

raster_2 (8 bit unsigned): 255

raster_3 (8 bit unsigned): 255

raster_4 (8 bit unsigned): 255

raster_b (8 bit unsigned): 2147483648

raster_1 is the one with only 3 values and that's the one that results in the 8 bit unsigned raster that keeps from mosaicing.

I added a screen print of what I have for inputs for Copy Raster.

rast.jpg

Something in my head just clicked. When raster_1 gets multiplied by 100, the highest value is 203. When raster_2 is multiplied, it's lowest value is 301 and the other rasters only get higher from there. I was not paying attention to the range of values covered by 8 bits versus 16 bits. I thought 8 bit pixel type was something else (don't know what what would have been) than a way to cover the range of grid values. (But that doesn't seem to explain the extremely high NoData Value for raster_b. Whatever.) I guess I should multiply my rasters by 1000 in Raster Calculator, this way they will all be in a 16 bit value range, 2000-7003, instead of the 201-703 that they are now when I multiply by 100.

Thanks for your time, Dan. I did not understand what you meant at first by promotion, but it's a bit more clear now.

ChrisDonohue__GISP
MVP Alum

An potential alternative:

Would Copy Raster (Data Management) work better than using Raster Calculator?  In Copy Raster, there is a Pixel Type (optional) setting that looks like it could be used to control the output.

Pixel type (Optional)

Determines the bit depth of the output raster dataset. If left unspecified, the output bit depth will be the same as the input.

There will be no rescaling of the raster values when a different pixel type is chosen. If the pixel type is demoted (lowered), the raster values outside the valid range for that pixel depth will be truncated and lost.

  • 1_BIT—A 1-bit unsigned integer. The values can be 0 or 1.
  • 2_BIT—A 2-bit unsigned integer. The values supported can be from 0 to 3.
  • 4_BIT—A 4-bit unsigned integer. The values supported can be from 0 to 15.
  • 8_BIT_UNSIGNED—An unsigned 8-bit data type. The values supported can be from 0 to 255.
  • 8_BIT_SIGNED—A signed 8-bit data type. The values supported can be from -128 to 127.
  • 16_BIT_UNSIGNED—A 16-bit unsigned data type. The values can range from 0 to 65,535.
  • 16_BIT_SIGNED—A 16-bit signed data type. The values can range from -32,768 to 32,767.
  • 32_BIT_UNSIGNED—A 32-bit unsigned data type. The values can range from 0 to 4,294,967,295.
  • 32_BIT_SIGNED—A 32-bit signed data type supported by GRID. The values can range from -2,147,483,648 to 2,147,483,647.
  • 32_BIT_FLOAT—A 32-bit data type supporting decimals.
  • 64_BIT—A 64-bit data type supporting decimals.

Source:  Copy Raster (Data Management) h

EDIT - scratch that - it looks like you already tried that.

Chris Donohue, GISP

0 Kudos
WeiYing1
Esri Contributor

I don't think the different pixel type cause the failure of Mosaic. It works well for me adding 8bit unsigned, 16bit signed and also 32bit float to MosaiC Dataset. So there must be other reasons. I agree with Professor Dan Patterson. 

0 Kudos