Opened 9 years ago
Closed 9 years ago
#6059 closed defect (duplicate)
AAIGrid: CreateCopy does not preserve DataType
Reported by: | Mike Taves | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | default | Version: | 2.0.0 |
Severity: | normal | Keywords: | |
Cc: |
Description
Here is a minimal example, tested with GDAL 1.11.2 and 2.0.0
from osgeo import gdal asc_drv = gdal.GetDriverByName('AAIGrid') mem_drv = gdal.GetDriverByName('MEM') nrow, ncol = 50, 20 ds = mem_drv.Create('', ncol, nrow, eType=gdal.GDT_Float32) out = asc_drv.CreateCopy('out.asc', ds) print(gdal.GetDataTypeName(out.GetRasterBand(1).DataType)) # Int32
The expected DataType is Float32
, e.g. from mem_drv.CreateCopy('', ds)
. The data type should be copied from the provided template dataset, as is documented for CreateCopy
.
Note:
See TracTickets
for help on using tickets.
It should be noted that the expected behaviour of preserving
Float32
is done when any raster value from the memory dataset appears like a float, such as1.1
, but not1.0
.