Can't see anything in HDF5 file I create from Julia

Hi all,

I have a question about HDF5 files created from Julia with HDF5.jl package. I create files with the following commands:

  # Open the HDF5 file for writing                                               
  fid = h5open(nameout, "w")                                                     
  #   Group for header   #                                                       
  g = create_group(fid, "header")                                                
  g["problemname"] = commands.problemname                                        
  g["timestep"]    = Δτ                                                          
  g["time"]        = τ                                                           
  #   Group for commands - simply store the entire file   #                      
  g = create_group(fid, "commands")                                              
  g["whole"] = commands.whole                                                    
  #   Group with grid data   #                                       
  g = create_group(fid, "grid")                                                  
  g["nnodes"]  = grid.nnodes                                                     
  g["nicells"] = grid.nicells                                                    
  g["xn"]      = grid.xn[1:3, 1:nn]                                              
  g["xc"]      = grid.xc[1:3, 1:nc]                                              
  #   Group with results   #                                                     
  g = create_group(fid, "results")                                               
  g["velocity"]        = field.u[1:3, 1:nf]                                      
  g["pseudo-pressure"] = field.pp[1:nc]                                          
  g["pressure"]        = field.p[1:nc]

Quite basic it is. I create three groups, save some date in and that’s all there is to it. The data is indeed stored because I can read it from Julia too, group by group, all is there, unaltered and safe. However, if I use hdfview to see what is in the files, I see nothing, have a look:

Why can’t I see my groups and datasets I am saving in hdfview? Any ideas?


In order to have your changes written to disk you should close the file (or call flush on the dataset). Otherwise you will not see the changes in an external program.

I do close the file, I only pasted part of the function I implemented. The lines I didn’t paste read:

  # Close the HDF5 file                                                          

As I wrote above, I can read the file from Julia (a separate function) and I am certain everything is saved.

That’s strange, I’m seeing the same behaviour when trying to open my own HDF5 files (also generated with HDF5.jl) using HDFView 2.11.

I’m guessing it’s an HDFView issue, as other tools such as h5ls work as expected on the same files. Maybe the HDFView version is too old, and can’t open files generated with recent HDF5 versions? Note that there is also an HDFView 3, but it doesn’t seem to be that easy to install on common Linux distributions.

1 Like

Indeed, h5ls works with the files I create from Jula, thanks :slight_smile: