How to read byte array to .h5 file?

Hi people..
I am new to HDF.
I wanted to read a bin file and store its byte[] in h5 file as byte[] array
itself.
And then read this h5 file and store its byte[] to my bin file back.
How do i go about doing it in java..
please help me...

···

--
View this message in context: http://hdf-forum.184993.n3.nabble.com/How-to-read-byte-array-to-h5-file-tp3792518p3792518.html
Sent from the hdf-forum mailing list archive at Nabble.com.

Dear all,

I am trying to write a compound data type in hdf5 format into a file. However, when it is time to insert the data to the data space, gfortran gives the error during the compilation:

gfortran -c -I/usr/local/hdf5-1.8.7/include -L/usr/local/hdf5-1.8.7/lib -lhdf5_fortran h5write.f95
h5write.f95:159.51:

     call h5dwrite_f(dset_id, memtype, f_ptr, hdferr)
                                                     1
Error: There is no specific subroutine for the generic 'h5dwrite_f' at (1)

When I comment out the last hd5write_f, the code correctly compiles and when run, it creates the data in the file and populate it with zeros. But when writing actual data, it fails at h5write_f step during compilation. My code is attached. I would be glad if you could help me on the matter.

Regards,

Ekin Akoglu

h5write.f95 (5.49 KB)

Side note, change integer(8) to:

integer(size_t) :: type_size, offset
integer(size_t) :: type_sizei, type_sizer

Other then that, I removed the module specific variables and the code compiled fine using gcc version 4.6.2

Are you sure you enabled the Fortran 2003 interface, i.e. the configure summary has

    Languages:

···

----------
                         Fortran: yes
                Fortran Compiler: /usr/bin/gfortran
           Fortran 2003 Compiler: yes

Which version of gfortran are you using? Can you compile compound_fortran2003.f90 at http://www.hdfgroup.org/ftp/HDF5/examples/src-html/f90.html

Also, you should consider using the h5offsetof function instead of calculating the offset yourself.

Scot

On 2012-03-02 09:18, Ekin Akoglu wrote:

Dear all,

I am trying to write a compound data type in hdf5 format into a file.
However, when it is time to insert the data to the data space,
gfortran gives the error during the compilation:

gfortran -c -I/usr/local/hdf5-1.8.7/include
-L/usr/local/hdf5-1.8.7/lib -lhdf5_fortran h5write.f95
h5write.f95:159.51:

    call h5dwrite_f(dset_id, memtype, f_ptr, hdferr)
                                                    1
Error: There is no specific subroutine for the generic 'h5dwrite_f' at (1)

When I comment out the last hd5write_f, the code correctly compiles
and when run, it creates the data in the file and populate it with
zeros. But when writing actual data, it fails at h5write_f step during
compilation. My code is attached. I would be glad if you could help me
on the matter.

Regards,

Ekin Akoglu

Thank you Izaak and Scot for the suggestions. Apparently, as Scot pointed out, I did not enable Fortran 2003 on compile time and that is why the errors occured. When I recompile with 2003 support and transferred the integer(8) to size_t, the code was compiled without problems.

Thanks.

Ekin

···

On 03/02/2012 06:41 PM, brtnfld@hdfgroup.org wrote:

Side note, change integer(8) to:

integer(size_t) :: type_size, offset
integer(size_t) :: type_sizei, type_sizer

Other then that, I removed the module specific variables and the code compiled fine using gcc version 4.6.2

Are you sure you enabled the Fortran 2003 interface, i.e. the configure summary has

   Languages:
----------
                        Fortran: yes
               Fortran Compiler: /usr/bin/gfortran
          Fortran 2003 Compiler: yes

Which version of gfortran are you using? Can you compile compound_fortran2003.f90 at http://www.hdfgroup.org/ftp/HDF5/examples/src-html/f90.html

Also, you should consider using the h5offsetof function instead of calculating the offset yourself.

Scot

On 2012-03-02 09:18, Ekin Akoglu wrote:

Dear all,

I am trying to write a compound data type in hdf5 format into a file.
However, when it is time to insert the data to the data space,
gfortran gives the error during the compilation:

gfortran -c -I/usr/local/hdf5-1.8.7/include
-L/usr/local/hdf5-1.8.7/lib -lhdf5_fortran h5write.f95
h5write.f95:159.51:

    call h5dwrite_f(dset_id, memtype, f_ptr, hdferr)
                                                    1
Error: There is no specific subroutine for the generic 'h5dwrite_f' at (1)

When I comment out the last hd5write_f, the code correctly compiles
and when run, it creates the data in the file and populate it with
zeros. But when writing actual data, it fails at h5write_f step during
compilation. My code is attached. I would be glad if you could help me
on the matter.

Regards,

Ekin Akoglu

_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

--
*Ekin Akoglu*

Research Assistant

Institute of Marine Sciences
Middle East Technical University
P.O. Box 28, 33731
Erdemli, Mersin
Turkey

Web: www.ims.metu.edu.tr
Email: ekin@ims.metu.edu.tr <mailto:ekin@ims.metu.edu.tr>
Phone: +90 324 521 34 34
GSM: +90 506 554 03 90
Fax: +90 324 521 23 27