[hdf-forum] xyz=C++, zyx=Fortran

Ger van Diepen diepen at astron.nl
Fri Jun 5 09:08:00 EDT 2009


We also have this problem.
Data are always stored in C order in HDF5 files.
In code where Fortran order is needed, the axes are reversed (thus data are not transposed).
So Fortran code accesses data arrays as [x,y,z], and C++ (or numpy) code as [z,y,x]

Cheers,
Ger 
 
>>> Dominik Szczerba <domi at vision.ee.ethz.ch> 06/05/09 2:37 PM >>> 
I dont think it is possible. I help myself out with attributes to know 
the ordering.

Together with the missing compression support in the high level API, 
those two are the biggest shortcomings of the otherwise great hdf5 library.

-- DOminik

Jens wrote:
> Hi everyone,
> 
> if you create a 3d-array(i,j,k) and use HDF5-library to dump it to disk,
> it will look different depending on the application-language:
> 
> Fortran-App (=ZYX-style)
>   [iii][iii][iii]  [iii][iii][iii]  [iii][iii][iii]
>  [       j       ][       j       ][       j       ]
> [                         k                         ]
> 
> C/C++-App (=XYZ-style)
>   [kkk][kkk][kkk]  [kkk][kkk][kkk]  [kkk][kkk][kkk]
>  [       j       ][       j       ][       j       ]
> [                         i                         ]
> 
> 
> Is there any possibility to tell hdf5 what array-style the application
> is using?
> The same way I can jump from little-endian- to big-endian-machines, I
> would like to jump from Fortran-Apps to C++Apps.
> 
> Greetings
> Jens
> 
> 
> ----------------------------------------------------------------------
> This mailing list is for HDF software users discussion.
> To subscribe to this list, send a message to hdf-forum-subscribe at hdfgroup.org.
> To unsubscribe, send a message to hdf-forum-unsubscribe at hdfgroup.org.


----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe at hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe at hdfgroup.org.



----------------------------------------------------------------------
This mailing list is for HDF software users discussion.
To subscribe to this list, send a message to hdf-forum-subscribe at hdfgroup.org.
To unsubscribe, send a message to hdf-forum-unsubscribe at hdfgroup.org.





More information about the Hdf-forum mailing list