User Defined Float Data Type

Hi,

Does anyone know how I could define a floating point data type to
represent

A 32-bit float in IBM system/360 format? I would like to be able to
create an

HDF file with the actual data being contained in an external SEG-Y file
(file

format used for storing seismic data). This would hopefully allow me to
have a

nice interface to existing SEG-Y files. Unfortunately the floating-point
data

Contained in this type of file is usually in IBM-32 bit format.

I have had a look at the HDF documentation and my first attempt looked
like this:

          hid_t IBM_type;

         IBM_type = H5Tcopy(H5T_IEEE_F32BE);

         H5Tset_precision(IBM_type, 32);

         H5Tset_fields(IBM_type, 31, 24, 7, 0, 24);

         H5Tset_ebias(IBM_type, 64);

         H5Tset_norm(IBM_type, H5T_NORM_NONE);

         H5Tset_order(IBM_type, H5T_ORDER_BE);

This sets the mantissa, exponent bit sizes/positions etc.

Of course, this doesn't work correctly because the IBM floating point

format uses base 16 rather than base 2 for the exponent power ie.

Float = sign * mantissa * 16^exponent rather than the usual

Float = sign * mantissa * 2^exponent

Anybody have an idea of how this could be achieved using HDF?

Thanks

Paul

Hi Paul,

I dunno if you got any response to this or not.

I am sure surprised the exponent base is NOT a programmable feature of
HDF5's native floating point format representation. I should think that
is a common enough variation that it would have been supported.

That said, I wonder if another way to handle this is via an hdf5
'filter'. You'd have to write the code to handle pushing data through
the filter (on write) and pulling data from the filter (on read) but
that could could then handle an opaque stream of bytes (IBM's floating
point format) and convert to some cannonical float format (such as IEEE)
and then it could be passed off to HDF5's conversion routines from there
if necessary.

If you are worried only about reading IBM format data from existing
legacy files, then you'd only have to implement the read-half of this
operation.

Mark

···

On Tue, 2010-09-07 at 05:36, paul wrote:

Hi,

Does anyone know how I could define a floating point data type to
represent

A 32-bit float in IBM system/360 format? I would like to be able to
create an

HDF file with the actual data being contained in an external SEG-Y
file (file

format used for storing seismic data). This would hopefully allow me
to have a

nice interface to existing SEG-Y files. Unfortunately the
floating-point data

Contained in this type of file is usually in IBM-32 bit format.

I have had a look at the HDF documentation and my first attempt looked
like this:

          hid_t IBM_type;

         IBM_type = H5Tcopy(H5T_IEEE_F32BE);

         H5Tset_precision(IBM_type, 32);

         H5Tset_fields(IBM_type, 31, 24, 7, 0, 24);

         H5Tset_ebias(IBM_type, 64);

         H5Tset_norm(IBM_type, H5T_NORM_NONE);

         H5Tset_order(IBM_type, H5T_ORDER_BE);

This sets the mantissa, exponent bit sizes/positions etc.

Of course, this doesn�t work correctly because the IBM floating point

format uses base 16 rather than base 2 for the exponent power ie.

Float = sign * mantissa * 16^exponent rather than the usual

Float = sign * mantissa * 2^exponent

Anybody have an idea of how this could be achieved using HDF?

Thanks

Paul

--
Mark C. Miller, Lawrence Livermore National Laboratory
================!!LLNL BUSINESS ONLY!!================
miller86@llnl.gov urgent: miller86@pager.llnl.gov
T:8-6 (925)-423-5901 M/W/Th:7-12,2-7 (530)-753-8511