[gdal-dev] Error: Unable to export GeoTIFF file with different datatypes per different bands. All bands should have the same types in TIFF.

Schindler, Fabian fabian.schindler at eox.at
Mon Oct 29 03:08:27 PDT 2018


Hi list,

I just tried to convert a Cloudsat (2B-GEOPROF to be exact) to a TIFF. I
try to do this using the Python bindings and creating a VRT [3] referencing
the Subdatasets of the HDF 4 file.

When I try to do this, I get the following error:

"Unable to export GeoTIFF file with different datatypes per different
bands. All bands should have the same types in TIFF."

The TIFF spec allows to define the dataset for each sample ([1] and [2]),
but it seems that GDAL does not support it.

I'd like to know if there is a way around this error or otherwise if it
would be possible/feasible to implement this in the driver?

I understand, that the TIFF driver is one of the oldest but still most used
ones around, so breaking compatibility would potentially be devastating.
Maybe putting this functionality behind a flag might be preferable.

Regards,
Fabian

[1] https://www.awaresystems.be/imaging/tiff/tifftags/bitspersample.html
[2] https://www.awaresystems.be/imaging/tiff/tifftags/sampleformat.html
[3] This is the generated temporary VRT I try to generate a TIFF copy from:

<VRTDataset rasterXSize="125" rasterYSize="20753">
  <VRTRasterBand dataType="Int16" band="1">
    <NoDataValue>15360</NoDataValue>
    <ComplexSource>
      <SourceFilename
relativeToVRT="0">HDF4_EOS:EOS_SWATH:"autotest/data/2017339123204_61738_CS_2B-GEOPROF_GRANULE_P_R04_E06.hdf":2B-GEOPROF:Radar_Reflectivity</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="125" RasterYSize="20753"
DataType="Int16" BlockXSize="125" BlockYSize="8000" />
      <SrcRect xOff="0" yOff="0" xSize="125" ySize="20753" />
      <DstRect xOff="0" yOff="0" xSize="125" ySize="20753" />
      <NODATA>15360</NODATA>
    </ComplexSource>
  </VRTRasterBand>
  <VRTRasterBand dataType="Int16" band="2">
    <NoDataValue>15360</NoDataValue>
    <ComplexSource>
      <SourceFilename
relativeToVRT="0">HDF4_EOS:EOS_SWATH:"autotest/data/2017339123204_61738_CS_2B-GEOPROF_GRANULE_P_R04_E06.hdf":2B-GEOPROF:Gaseous_Attenuation</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="125" RasterYSize="20753"
DataType="Int16" BlockXSize="125" BlockYSize="8000" />
      <SrcRect xOff="0" yOff="0" xSize="125" ySize="20753" />
      <DstRect xOff="0" yOff="0" xSize="125" ySize="20753" />
      <NODATA>15360</NODATA>
    </ComplexSource>
  </VRTRasterBand>
  <VRTRasterBand dataType="Byte" band="3">
    <NoDataValue>-99</NoDataValue>
    <ComplexSource>
      <SourceFilename
relativeToVRT="0">HDF4_EOS:EOS_SWATH:"autotest/data/2017339123204_61738_CS_2B-GEOPROF_GRANULE_P_R04_E06.hdf":2B-GEOPROF:CPR_Cloud_mask</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="125" RasterYSize="20753"
DataType="Byte" BlockXSize="125" BlockYSize="8000" />
      <SrcRect xOff="0" yOff="0" xSize="125" ySize="20753" />
      <DstRect xOff="0" yOff="0" xSize="125" ySize="20753" />
      <NODATA>-99</NODATA>
    </ComplexSource>
  </VRTRasterBand>
</VRTDataset>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20181029/cc211791/attachment.html>


More information about the gdal-dev mailing list