In ArcGIS Pro I want to automate some tests on rasters, either stored in .gdb- or .tiff-files.
One of the tests requires checking the Pixel Type and Pixel Depth of the raster (has to be floating point with at least 32 Bit). These can be manually accessed trough the 'Raster information' section in the Layer Properties.
I can get the Pixel Type using the tool 'Get Raster Properties' selecting for 'Cell value type', however, there doesn't appear to be an option to select for 'Pixel Depth'.
'Build Raster Attribute Table (Data Management)' mentions 'You cannot build a raster attribute table for a raster dataset that is a pixel type of 32-bit floating point.', so if I would be able to execute this function I would be nearly sure the raster is not an integer pixel type, but that wouldn't exclude other reasons why 'Build Raster Attribute Table' might fail. Alsop it would be quite unintuitive for maintainers of the tool.
If someone knows a python function that could help out I could build a script tool so that would work as well.
Any help would be greatly appreciated.
If you need a raster with a floating-point representation, you may convert your raster using
arcpy.management.CopyRaster.You may also want to look into
arcpy.ia.Float(requires a specialized license).The pixel depth is a value applying to the whole raster:
You could also analyze the raster/image using an Imaging Library such as pillow. However, this would only works if the raster is available as a file.
The library pillow seems to call the pixel depth modes:
Please note: I haven't tried it myself.