Unable to open file with h5info, h5read

15 views (last 30 days)
T Ram
T Ram on 31 May 2017
Commented: per isakson on 26 Apr 2019
Hi everyone,
I try to open a .he5 file by using
>> filename='MLS-Aura_L2GP-IWC_v03-30-c01_2004d336.he5';
>> fileinfo=h5info(filename)
It returns:
Error using h5infoc
The HDF5 library encountered an error and produced the following stack
trace information:
H5F_locate_signature unable to find a valid file signature
H5F_super_read unable to find file signature
H5F_open unable to read superblock
H5Fopen unable to open file
Error in h5info (line 75);
hinfo = h5infoc(filename,location);
Then I try with "hdf5info"
>> fileinfo=hdf5info(filename)
It gives:
Error using hdf5infoc
Call to HDF5 library failed (invalidFile): "Not a valid HDF5 file:
I:\DOCTORAT\TRAITEMENT\DONNEES\Dec2004v3\MLS-Aura_L2GP-IWC_v03-30-c01_2004d336.he5".
Error in hdf5info (line 79)
[info.Offset, info.GroupHierarchy, majnum, minnum, relnum] = ...
Do you know where is the problem?
Note that I try with an another file, a previous version of data and this command works.
Thank a lot for help
  3 Comments
Walter Roberson
Walter Roberson on 25 Apr 2019
Please show the first 80 or so bytes of the file, following the response I gave below.
per isakson
per isakson on 26 Apr 2019
I have found the program HDF5View very useful when working with HDF5-files. See HDFView is a visual tool for browsing and editing HDF4 and HDF5 files.
If HDFView fails to open your file, your file is most likely not a correct HDF-file.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 31 May 2017
The file is not in HDF5 file format (or HDF4 format either.)
To help debug it, try
fid = fopen('testdcm.fig');
dat = fread(fid,[1, 80], 'uint8');
fclose(fid)
and show us the output of
dat
sprintf('%02x ', dat)
char(dat)
  2 Comments
T Ram
T Ram on 31 May 2017
Thank you for answer
It gives: >> fid = fopen('testdcm.fig');
>> dat = fread(fid,[1, 80], 'uint8');
Error using fread
Invalid file identifier. Use fopen to generate a valid file identifier.
Walter Roberson
Walter Roberson on 31 May 2017
Sorry, change the fid = fopen('testdcm.fig'); line to
fid = fopen(filename);

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!