Dimension Scales in C++ interface?


Does the HDF5 C++ API have an interface for creating and reading dimension scales?

I have been trying to use the C++ API, but, I suspect this may force me over the the C API. I understand it has more flexibility.


PS I’d be interested in knowing the support available for dimension scales in h5cpp as well.


If you are looking for flexibility without trade offs you might want to give a try to H5CPP an HDF5 header only interface for modern C++. From your point the most interesting feature is seamless integration/conversion from/to HDF5 CAPI hid_t descriptors.

The project embraces most HDF5 CAPI functionality and extends it with high performance packet table implementation. The only requirement is to link against: -lhdf5 -lz -ldl -lm.

From the HDF5 dimension scales documentation there are only a few calls which you can pass h5::ds_t dataset descriptor either by static_cast<hid_t>( ds ) or directly using H5CPP automatic conversion capabilities. If you have any problems getting working feel free to shoot me a line.

debian/ubuntu/rpm packages are here as well as the LLVM based source cod transformation tool. While other OS-s are not yet supported windows and mac are conformed to work. Just copy the include files into your project directory.

best wishes: steven



I saw your presentation a couple of weeks ago on this. Your library looks really solid and if I were to move to one, it is the one I would use. For the moment I’m trying to get this done without adding an additional library, though (even though the templates are quite lightweight, easy to add). My next iteration, I may incorporate the templates.


Maybe someone has other ideas? What about mixing the C interface and the C++ interface - I’ve already gotten the code half written in the original C++ interface, and I’d had to have to go back and re-write (though that would be cleanest, I expect, for consistency).

Best Regards,


Hello Mike,

The C++ API offers wrappers for only a subset of the main C library and, unfortunately, dimension scales are not part of that subset at this time. If you’d like to continue using the C++ API but need some features that are not yet available, you can use the those features from the C library passing in the correct identifiers via the member function getId().

Thank you,



Hi Bihn-Minh,

I started using the C API and getId() from the C++ created items. That worked out well. I have written dimension scales to the file (confirmed with HDF Compass).

But, now I am trying to read them back in a general way. I don’t understand how H5DSIterate is supposed to work - though it seems like it should be that. All I really want is to get the id of the Dimension Scale dataset from the parent dataset, something like

dsid = H5Dget_datascale( did, indx )

is it possible to do this? Maybe I need to get that from the Data Space? I expect I could also just go to the DIMENSION_LIST attribute and get it from there. Alternately, I could explicitly add DIMENSION_LABELS, and use them as names of the variable which are the dimension scales, but, that seems a bit artificial.

Thanks for the help.

Best Regards,