# Using HDF5.jl and reading h5 data to Julia?

**URL:** <https://discourse.julialang.org/t/using-hdf5-jl-and-reading-h5-data-to-julia/93232>\
**Category:** General Usage\
**Tags:** question, package\
**Created:** [January 19, 2023, 8:31pm UTC](https://discourse.julialang.org/t/using-hdf5-jl-and-reading-h5-data-to-julia/93232 "2023-01-19T20:31:38Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![stephancb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stephancb/32/14243_2.png) [@stephancb](https://discourse.julialang.org/u/stephancb)\
**Post date:** [January 20, 2023, 4:07pm UTC](https://discourse.julialang.org/t/using-hdf5-jl-and-reading-h5-data-to-julia/93232/7 "2023-01-20T16:07:21Z")

</div>

I don’t have the `STROMBOLI.h5` file, but an example for exploration of another file might be:

Find out what is in the file:

```julia
julia> h5open("data/eiscat/MAD6400_2022-12-12_manda_60@uhf.hdf5", "r")
🗂️ HDF5.File: (read-only) data/eiscat/MAD6400_2022-12-12_manda_60@uhf.hdf5
├─ 📂 Data
│ └─ 🔢 Table Layout
└─ 📂 Metadata
   ├─ 🔢 Data Parameters
   ├─ 🔢 Experiment Notes
   ├─ 🔢 Experiment Parameters
   ... more metadata

```

Get all datasets without loading them (in case they are big):

```julia
datasets=HDF5.get_datasets(h5file)
6-element Vector{HDF5.Dataset}:
 🔢 HDF5.Dataset: /Data/Table Layout (file: data/eiscat/MAD6400_2022-12-12_manda_60@uhf.hdf5 xfer_mode: 0)
 🔢 HDF5.Dataset: /Metadata/Data Parameters ...
... more metadata sets

```

The actual data is the 1st set, the others are metadata (which are probably important as well).

```julia
julia> h5data=datasets[1]

```

```julia
julia> size(h5data)
(94776,)

```

So I get a vector of named tuples:

```julia
julia> keys(h5data[1])
(:year, :month, :day, :hour, :min, :sec, :recno, :kindat, ....

```

Print parameters `gdalt` and `ne`, the first three vector elements:

```julia
julia> foreach(x -> println("height = $(x[:gdalt]), ne = $(x[:ne])"), h5data[1:3])
height = 20.169572265625, ne = 2.282413824e9
height = 20.5092578125, ne = 1.0e6
height = 20.86676953125, ne = 2.51701408e8

```

---

_[View the full topic](https://discourse.julialang.org/t/using-hdf5-jl-and-reading-h5-data-to-julia/93232)._
