-
-
Notifications
You must be signed in to change notification settings - Fork 370
Support Numpy structured arrays containing an object #422
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
Conversation
|
Code below works with numpy 1.14.0, but does not work with 1.13.3: So zarr will require numpy 1.14.0 to support structured arrays containing object: |
|
Tests fail because of numpy old version |
|
Hello @ombschervister! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2019-11-09 14:24:39 UTC |
|
Structured arrays tests are ignored if numpy version is lower than 1.14.0. |
|
Thanks @ombschervister, this looks good to me, no objections to adopting this change. Could you resolve conflicts and also add an item to the release notes (docs/release.rst). I'm about to go offline for a couple of weeks but hopefully someone else from @zarr-developers/core-devs can help finalise this. |
done |
|
What's the status of this PR? If it's working, I think it might save me some work in fixing this: scverse/scanpy#832 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @ombschervister! When you get a moment, could you please update to resolve the merge conflict (sorry for such a delayed response). Based on #422 (comment) I think this should be good to merge once the conflicts have been resolved.
|
@jrbourbeau If I could help speed this along by resolving the conflict, I'd be happy to give it a shot. It just looks like conflicts in the imports, so I think it might be a quick fix. |
|
Thanks for volunteering @ivirshup. I think only @ombschervister, or others with write access to |
|
No worries, I was thinking I'd branch from this, merge master, then open a PR from the new branch. Something like: Looks like that might be mostly solved though. Thanks for the update @ombschervister! Any chance there's an eta on when this might get into a release? I'm trying to figure out how much effort I should put into working around this. |
|
Go for it 👍 |
|
@jrbourbeau |
|
@ombschervister, just gave this a try. I noticed some errors if tried to create a zarr array using this kind of dtype via import numpy as np
import zarr
t = [("a", object), ("b", object)]
a = np.array([("lorem", "ipsum"), ("dolor", "sit"), ("amet", "consectetur")], dtype=t)
z = zarr.open({})
z.create("d1", shape=a.shape, dtype=t, fill_value=None, object_codec=zarr.Pickle())
z.create("d2", shape=a.shape, dtype=t, fill_value=0, object_codec=zarr.Pickle())Traceback---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
~/github/zarr-python/zarr/meta.py in decode_array_metadata(s)
41 dtype = decode_dtype(meta['dtype'])
---> 42 fill_value = decode_fill_value(meta['fill_value'], dtype)
This error would also be thrown if I called: Lines 238 to 241 in 3964f10
Lines 153 to 156 in 58b1786
In short, you can't call |
|
Migrated to #702 |
partial fix #418
TODO:
tox -e docs)