Issue Report Rephrased:

For certain rasters with an *Int16* data type, calling AutoCreateWarpedVRT
changes the dataset type to *Int32*. For example:

>>> ds1 = gdal.Open("dem.tif", gdalconst.GA_ReadOnly)
>>> ds1.GetRasterBand(1).DataType
3
>>> ds2 = gdal.AutoCreateWarpedVRT(ds1)
>>> ds2.GetRasterBand(1).DataType
5
>>> ds2.GetRasterBand(1).GetNoDataValue()
32767.0

However, when I tested it on another raster, the type did not change:

>>> ds1 = gdal.Open("int16_50m.tif", gdalconst.GA_ReadOnly)
>>> ds1.GetRasterBand(1).DataType
3
>>> ds2 = gdal.AutoCreateWarpedVRT(ds1)
>>> ds2.GetRasterBand(1).DataType
3
>>> ds2.GetRasterBand(1).GetNoDataValue()
-32768.0

Is this a bug? It appears that the data type change might be influenced by
the nodata value.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to