I am trying to write a HDF5 file in Julia. Now suppose I want to create a dataset mydataset which contains a matrix A in the group mygroup, what datatype should I use in the function create_dataset? (In the document, the function looks like create_dataset(parent, path, datatype, dataspace; properties…)).
Also, suppose I want to save an object which is a list of matrices [A1,A2,A3,A4], what datatype should I use?
Finally, if A is a static array. Should I transform it to a normal array before saving it to the HDF5 file? I want to make sure that I can read the dataset in python.
This also answers your second question: you cannot serialize a vector of matrices directly, but if those matrices have the same size, then you can merge them all together in the third dimension, and store them as a single 3D tensor. Or if that doesn’t work, you need to manually assign subkeys to your arrays/matrices:
for (i, A) in enumerate([A1, A2, A3, A4])
h5["A/$i"] = A
end
As for the third question, I have no experience with static arrays, but I would assume whatever conversion is necessary, HDF5 takes care of it for you. That being said, it should be fairly straightworward to try it out.