Skip to content
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

Question: Does h5py still find "compound" dtypes useful? #2342

Open
seberg opened this issue Nov 16, 2023 · 1 comment
Open

Question: Does h5py still find "compound" dtypes useful? #2342

seberg opened this issue Nov 16, 2023 · 1 comment

Comments

@seberg
Copy link

seberg commented Nov 16, 2023

I am wondering if h5py is still using "compount"/"union" dtypes in h5py. That is dtypes which are a normal (non void) dtype, but additionally have fields, such as:

dt = np.dtype(("S8", np.dtype([("a", "f4"), ("b", "f4")])))

Which is a bytes dtype, but additionally supports field access via the struct dtype.

The way these are constructed in NumPy always seemed very shaky to me, and it also looks always a bit like a source of complexity that might be buggy. So I am just curious if anyone thinks these are useful enough (as opposed to asking users to use arr.view(structured_dtype))

Considering that h5py seems to at somepoint have used it, I now guess it is useful enough, but wanted to ask.

@takluyver
Copy link
Member

I didn't know that was possible until now, and I don't know what h5py ever used it for. Regular compound dtypes are supported, but as far as I know, the data type in HDF5 can either be compound (using fields) or a string, not both at once.

I can't guarantee that it's not lurking in some odd corner of the codebase, though. And I obviously don't know if someone might have found 'one weird trick' that hinges on giving such a dtype to h5py. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants