[gdal-dev] Support for Float16 and CFloat16
Even Rouault
even.rouault at spatialys.com
Mon Mar 26 11:53:06 PDT 2018
Piyush,
> I tried to search the gdal-dev archives but could not find much on this
> topic.
> HDF5 files support half precision floats and so does numpy. I was wondering
> if there were any plans to include support for this data type?
There's no native support for Float16 in C++, so your best option is to
promote to Float32 (or CFloat32) when reading for a format where there are
stored as half floats. This is for example what is done in the GTiff driver (
HalfToFloat() function in frmts/gtiff/tif_float.c )
You could add a NBITS=16 metadata item in the IMAGE_STRUCTURE metadata domain
of the band(s) to reflect the original precision.
Even
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list