[Nexus] Reading generic h5 files.

tieman tieman at aps.anl.gov
Tue Feb 20 21:18:19 GMT 2007


Hi all,

Can Nexus (3.0.0) read "generic" h5 files that were not written with the 
Nexus API.  Experimentation tells me the answer is "no" but I am holding 
out hope that I am doing something wrong...

I need to exchange data between a process I've written that uses Nexus 
to read/write HDF5 files and Matlab.  Matlab can read the files I 
generate just fine, however, I can not read the files Matlab generates.  
We took an h5 file I wrote with nexus and read it into Matlab without a 
problem.  We then rewrote the file from within Matlab, but my Nexus 
program can not read it.

I think I've managed to trace part of the problem to NX5GetNextEntry and 
the following lines:

           attr1 = H5Aopen_name(grp, "NX_class");
           type=H5T_C_S1;
           atype=H5Tcopy(type);
           H5Tset_size(atype,128); 
           iRet = H5Aread(attr1, atype, data);
           strcpy(nxclass,data);

I don't understand h5 very well yet but it looks to me like this section 
of code is looking for a "group type" of "NX_class" which Matlab is 
unlikely to have written and so the later call to H5Aread fails.  I see 
NX5MakeGroup seems to attach the "NX_class" type when the file is created.

Is there a way around this?  I have a strong need to inter-operate with 
Matlab and potentially additional sources of h5 data but I already have 
a large codebase built around NAPI that I'd love to leverage as well.  
Any thoughts?

Thanks!

Brian Tieman
Advanced Photon Source
Argonne National Laboratory




More information about the NeXus mailing list