I believe the type your data is stored and the type you write or read from
a separate issues and HDF deals with it all for you if you use types
properly.

When you create a dataset you select the actual storage type. If you use a
"NATIVE" type then the type on disk is the endianness of your system.


When reading and writing you also give a type for the buffer your data in
memory is. I believe this can be any type that is convertable to the type
used for the dataset creation. So you you could make a dataset in BE then
have write data from memory that is LE and HDF does the translation as long
as you told it the correct types. The useful thing here is that if you use
"NATIVE" types for read/write then it doesn't matter what type the dataset
was created with. HDF works it out for you. I imagine performance will
suffer though if they don't match.

CAUTION: I don't actaully know that this is true, but that's always been my
impression of how it works.


- David

On Thu, Jan 7, 2016 at 10:12 AM, [email protected] <[email protected]>
wrote:

> I don't think this is right. HDF deals with the endian-ness under the hood
> and you don't have to muck with it (in either #1 or #2).
>
> -----Original Message-----
> From: Hdf-forum [mailto:[email protected]] On Behalf
> Of houssen
> Sent: Thursday, January 07, 2016 10:44 AM
> To: [email protected]
> Subject: Re: [Hdf-forum] Portable way to write / read data
>
> Any answer ? No clue on that ?
>
> FH
>
> Le 2016-01-03 15:56, houssen a écrit :
> > Hello,
> >
> > What is the portable way to write / read data ?
> >
> > Say my data is an array of doubles (C type).
> > My understanding is that if I write them in a data set with the
> > H5T_NATIVE_DOUBLE type, then:
> > 1. the type is modified to H5T_IEEE_F64BE or H5T_IEEE_F64LE according
> > to the endianness (say it is BE) of the computer I use.
> > 2. data are written in the hdf5 file.
> > Now I have to read the data from another computer (say it is a LE
> > one).
> > My understanding is that I still must use the H5T_NATIVE_DOUBLE type,
> > and, that:
> > 1. data are read in BE.
> > 2. data are converted to LE.
> > 3. data are sent back (as LE).
> >
> > Am I correct ? Is that the right way to do things ? If not, what is
> > the right way ?
> >
> > Happy new year,
> >
> > Franck
> >
> >
> > _______________________________________________
> > Hdf-forum is for HDF software users discussion.
> > [email protected]
> >
> > http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.or
> > g
> > Twitter: https://twitter.com/hdf5
>
>
> _______________________________________________
> Hdf-forum is for HDF software users discussion.
> [email protected]
> http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
> Twitter: https://twitter.com/hdf5
> _______________________________________________
> Hdf-forum is for HDF software users discussion.
> [email protected]
> http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
> Twitter: https://twitter.com/hdf5
>
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Reply via email to