Changing data types in finters

Hi,
I would like to write a simple filter function which would take input buffer
of some floating point type and rewrite the buffer with integer type data
(rounded values).

For example,
buf = {1.1, 2.3, 4.5}
will be filtered to
buf = {1, 2, 4}

Dataset is of type H5T_NATIVE_FLOAT and I would like that to be changed by
filter to H5T_NATIVE_INT32.

Is that possible, or should dataset be created with type H5T_NATIVE_INT32
and filled with memcpy-ed floats and then in filter look at them as if they
were floats?

Thank you,
Lisur

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/Changing-data-types-in-finters-tp4025187.html
Sent from the hdf-forum mailing list archive at Nabble.com.

Hi Lisur,

···

On Jun 26, 2012, at 4:54 AM, Lisur wrote:

Hi,
I would like to write a simple filter function which would take input buffer
of some floating point type and rewrite the buffer with integer type data
(rounded values).

For example,
buf = {1.1, 2.3, 4.5}
will be filtered to
buf = {1, 2, 4}

Dataset is of type H5T_NATIVE_FLOAT and I would like that to be changed by
filter to H5T_NATIVE_INT32.

Is that possible, or should dataset be created with type H5T_NATIVE_INT32
and filled with memcpy-ed floats and then in filter look at them as if they
were floats?

  Will the H5Tconvert() routine work for you?

    Quincey

Thank you very much ... I think H5Tconvert() will be enough :slight_smile:

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/Changing-data-types-in-finters-tp4025187p4025192.html
Sent from the hdf-forum mailing list archive at Nabble.com.