Hi Jurgen, On May 28, 2010, at 8:09 AM, Brommundt Jürgen wrote:
> Hi! > > I am using Fortran to create and fill HDF5 files with data. Postprocessing of > the created HDF5 files uses h5py, a Python library. > I use the HDF5 Lite API to add a double precision variable as attribute: > call > h5ltset_attribute_double_f(outf_id,".",trim(attribute_name(i)),double_variable(i),1,hdferr) > > which works fine. But as soon as I read the attribute with h5py I see, that > the attribute is added as an array with one single element > (array([double_variable])). yes, this was an original design, and, personally, I agree with you that it may not be the best choice for describing the attribute's dataspace. H5S_SCALAR will work better and make more sense in 90% of use cases, but it is too late to change. We should probably be looking into overloading the function and allow some flexibility in the dataspace specification. > This complicates postprocessing, hence I am looking for a way to write a > single double precision variable as an attribute. Is there a way of doing > this with Fortran? > Yes, you can just use pure HDF5 Fortran API to create a double precision attribute; use h5screate_f(H5S_SCALAR_F, space_id, hdferr) call to create a dataspace for the attribute. Please let me know if you have any questions. Elena > Thanks in advance, > Jürgen > _______________________________________________ > Hdf-forum is for HDF software users discussion. > [email protected] > http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
_______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
