In addition to Mubsi’s great example, here’s another thread which gives some code that’s pretty similar, but has a few other examples that may be useful. E.g. it shows how to create multiple datasets within a single h5 file. That’s implicit in what Mubsi shows, but this code actually writes it out explicitly.