-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enhancement request: ability to export dicts as shareable/generic HDF5 #133
Comments
Hi @gpetty, glad to see you like the functionality that This issue is very interesting and one I agree with, as I have thought about it myself quite a few times as well while rewriting So, the big issue is that in Python, objects do not carry any names. The above works well for basically all types of objects, except the one you are mentioning: dicts. I could take a good hard look at it again and see if there is maybe a way to do it, but I am not sure if there is. |
Alright, I just had to do something somewhat similar for solving the issue raised in #90, and there it was already quite a challenge to get rid of the |
Upon reflection, I recognize that part of the difficulty undoubtedly stems from hickle's generality -- it needs to be able to do pickle-like exporting for literally any possible object, no matter how arcanely structured. Perhaps what's needed is a more specialized utility specifically for dicts satisfying particular constraints, such as no data types not supported by HDF5. In my case, the dicts I'm working with are constructed from fields in an existing HDF5 file, so automatically exporting those same data fields to a new HDF5 file with analogous structure should be fairly straightforward. But as I said, I see now that that's not necessarily compatible with the overarching goal of hickle. |
@gpetty Exactly. |
Looks like #138 addresses this! |
Closing this as it's mostly addressed -- as well as can be while maintaining generality -- in v5.0.0. E.g. for a dict with keys 'a', 'b' and 'c':
|
It's fantastic that hickle can automatically export a dict object as an hdf5 file, but the resulting structure is not very transparent to someone (e.g., a non-Python user who doesn't have access to hickle) who might want to open and explore the file using some other hdf5 library or utility (e.g., panoply). In particular, the partial field name 'data_0' shows up redundantly at every level, and I'm not sure why that's necessary.
I would like to be able to use hickle to create a large number of clean/generic hdf5 files for sharing with people using C, Fortran, and other languages, so I hope a future version can somehow provide that option, so that the structure of the hdf5 file can be accessed in exactly the same way as the original dict.
The text was updated successfully, but these errors were encountered: