How to import HDF5 files with SZIP filter

14 views (last 30 days)
Sergio Pinilla
Sergio Pinilla on 17 May 2019
Answered: Shivam Sardana on 22 May 2019
I have some data in the dataset "winspec_STD" but i have tried to use h5read function to access that dataset without any luck. I want to load each of the 2x1341x1x1x1 chunks to a matlab matrix. I dont know if the reason of the error is the szip filter or something else (my first time dealing with .h5 files, so not really experienced with them). I have explored the files also with the HDFView as another post in MATLAB Answers suggested, but didnt provide much more information. The size of the chunks really confuses me, i also tried to extract just a portion of the data with h5read, but again no result.
>> h5info('190516-004.h5')
ans =
struct with fields:
Filename: 'C:\.....\190516-004.h5'
Name: '/'
Groups: []
Datasets: [4×1 struct]
Datatypes: []
Links: []
Attributes: []
>> h5disp('190516-004.h5', '/winspec_STD')
HDF5 190516-004.h5
Dataset 'winspec_STD'
Size: 2x1341x21x1x1
MaxSize: 2x1341x21x1x1
Datatype: H5T_IEEE_F32LE (single)
ChunkSize: 2x1341x1x1x1
Filters: szip
FillValue: 0.000000
>> data1 = h5read('190516-004.h5', '/winspec_STD')
Error using h5readc
The HDF5 library encountered an error and produced the following stack trace information:
H5PL__find can't open directory
H5PL_load search in paths failed
H5Z_pipeline required filter 'szip' is not registered
H5D__chunk_lock data pipeline read failed
H5D__chunk_read unable to read raw data chunk
H5D__read can't read data
H5Dread can't read data
Error in h5read (line 58)
[data,var_class] = h5readc(Filename,Dataset,start,count,stride);
Thank you
Rergards
Sergio

Answers (1)

Shivam Sardana
Shivam Sardana on 22 May 2019
szip filter is not supported by h5read. szip filter depends on third-party compression libraries. To read the file which includes use of szip filter, you must install HDF5 filter plugin. You can refer to this documentation link for more details on importing HDF5 files: https://www.mathworks.com/help/matlab/import_export/importing-hierarchical-data-format-hdf5-files.html

Tags

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!