I am trying to use GDAL Python API to deal with some big raster, and when I read these rasters into Python, I get warnings like that:
Warning 1: TIFFFetchNormalTag:ASCII value for tag "GeoASCIIParams" contains null byte in value; value incorrectly truncated during reading due to implementation limitations
Warning 1: TIFFReadDirectory:Sum of Photometric type-related color channels and ExtraSamples doesn't match SamplesPerPixel. Defining non-color channels as ExtraSamples.
Warning 1: TIFFFetchNormalTag:ASCII value for tag "GeoASCIIParams" contains null byte in value; value incorrectly truncated during reading due to implementation limitations
Warning 1: TIFFReadDirectory:Sum of Photometric type-related color channels and ExtraSamples doesn't match SamplesPerPixel. Defining non-color channels as ExtraSamples.
Do anybody encounter problems like this? Why did this thing happen?
The raster I use is about 2.2G for one raster, and the raster' format is TIFF.the warnings don't affect the later use of the data, it is still an annoying issue, I want to know how to fix this.
Best Answer
You can suppress the warnings (as long as you're sure there's no real issue with your data) with
gdal.PushErrorHandler('CPLQuietErrorHandler')
. If you do this any errors will also not get printed, so make sure you tell GDAL to raise a Python exception when an error occurs withgdal.UseExceptions()
.E.g.