I have a simple model that calculates the NDVI from bands 3 and 4 of a raster dataset. The input bands are 8-bit unsigned, whereas the default output NDVI is signed 32 bit.
How can I specify the pixel depth for the output NDVI as 8 bit unsigned?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityI have a simple model that calculates the NDVI from bands 3 and 4 of a raster dataset. The input bands are 8-bit unsigned, whereas the default output NDVI is signed 32 bit.
How can I specify the pixel depth for the output NDVI as 8 bit unsigned?
The result from NDVI will be continuous (i.e. decimal) values between -1 to +1, therefore the raster must be able to store these values, and will use signed pixel depth. If you truly want 8-bit unsigned, you will need to adjust the expression in the raster calculator by linearly scaling to values between 0-255 and then applying the int() function on the entire calculation. However, this still does not guarantee that the output will be 8-bit unsigned. Perhaps try Copy Raster on the scaled raster with the optional pixel_type parameter in your model to help with this.
After running Raster Calculator, use the Copy Raster tool with the pixel_type
parameter set to 8_BIT_UNSIGNED
, as shown below.