Hdf5read inputs

hdf5

#1

Hello, everyone!

Have a question regarding hdf5 package in Julia, specifically the hdf5read function?

I see this in the main page of the github

A = collect(reshape(1:120, 15, 8))
h5write("/tmp/test2.h5", “mygroup2/A”, A)
data = h5read("/tmp/test2.h5", “mygroup2/A”, (2:3:15, 3:5))

I understand the data is stored in A, and that we are writing the data stored in A to the file called, “/tmp/test2.h5”, but what is the “mygroup2/A” pointing to? It is also there in the h5read function. Is it some kind of field that is already present in the data? Am used to using Matlab and when I use read functions, i generally just give the filename as input, so I am confused as to what the “mygroup2/A” input is doing exactly and what it is.

Thanks!
Ginny


#2

HD5 files are themselves kinda like a mini-filesystem. Not only can you give your data a name, you can also organize it into “groups” — kinda like directories within the file itself. In this case, you’re storing the data with the name "A" within a group "mygroup2". You don’t need to use groups, but HDF5.jl supports them.


#3

Thanks, Matt!
That makes a lot of sense now :slight_smile: