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

**URL:** <https://discourse.julialang.org/t/cant-see-anything-in-hdf5-file-i-create-from-julia/70992>\
**Category:** General Usage\
**Tags:** question, package, hdf5\
**Created:** [November 5, 2021, 8:06am UTC](https://discourse.julialang.org/t/cant-see-anything-in-hdf5-file-i-create-from-julia/70992 "2021-11-05T08:06:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Niceno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niceno/32/29648_2.png) [@Niceno](https://discourse.julialang.org/u/Niceno)\
**Post date:** [November 5, 2021, 8:06am UTC](https://discourse.julialang.org/t/cant-see-anything-in-hdf5-file-i-create-from-julia/70992/1 "2021-11-05T08:06:26Z")

</div>

Hi all,

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

```julia
  # 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:

 ![hdf5](https://global.discourse-cdn.com/julialang/original/3X/e/0/e0973d82de5c9dee367371568ba74fa66726eaf8.png)

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

_Cheers_

---

<div class="post-metadata">

**Author:** ![fabiangans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fabiangans/32/2624_2.png) [@fabiangans](https://discourse.julialang.org/u/fabiangans)\
**Post date:** [November 5, 2021, 8:41am UTC](https://discourse.julialang.org/t/cant-see-anything-in-hdf5-file-i-create-from-julia/70992/2 "2021-11-05T08:41:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Niceno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niceno/32/29648_2.png) [@Niceno](https://discourse.julialang.org/u/Niceno)\
**Post date:** [November 5, 2021, 8:44am UTC](https://discourse.julialang.org/t/cant-see-anything-in-hdf5-file-i-create-from-julia/70992/3 "2021-11-05T08:44:46Z")

</div>

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

```julia
  # Close the HDF5 file                                                          
  close(fid)

```

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

---

<div class="post-metadata">

**Author:** ![jipolanco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jipolanco/32/12129_2.png) [@jipolanco](https://discourse.julialang.org/u/jipolanco)\
**Post date:** [November 5, 2021, 9:30am UTC](https://discourse.julialang.org/t/cant-see-anything-in-hdf5-file-i-create-from-julia/70992/4 "2021-11-05T09:30:39Z")

</div>

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](https://www.hdfgroup.org/downloads/hdfview/#download), but it doesn’t seem to be that easy to install on common Linux distributions.

---

<div class="post-metadata">

**Author:** ![Niceno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niceno/32/29648_2.png) [@Niceno](https://discourse.julialang.org/u/Niceno)\
**Post date:** [November 5, 2021, 10:28am UTC](https://discourse.julialang.org/t/cant-see-anything-in-hdf5-file-i-create-from-julia/70992/5 "2021-11-05T10:28:50Z")

</div>

Indeed, `h5ls` works with the files I create from Jula, thanks 🙂
