zarr-python
zarr-python copied to clipboard
Raise informative error when chunk size 0
This PR checks if any dimension has a chunk size of 0 during the chunk normalization process and raises an informative error accordingly. Closes #303.
TODO:
- [x] Add unit tests and/or doctests in docstrings
- [ ] Add docstrings and API docs for any new/modified user-facing classes and functions
- [ ] New/modified features documented in docs/tutorial.rst
- [x] Changes documented in docs/release.rst
- [x] Docs build locally (e.g., run
tox -e docs) - [x] AppVeyor and Travis CI passes
- [x] Test coverage is 100% (Coveralls passes)
Gentle ping @alimanfoo @jakirkham whenever you get a moment post-CZI application madness ; )
Thanks @jrbourbeau, I'll take a look first thing next week :-)
What if we have an array with shape (4, 0)? Should we allow a size 0 chunk in this case?
That's a good questions. I'm not sure whether or not it makes sense for zarr to support these cases. Do you have a sense for this?
One option would be to update this PR to raise a NotImplementedError with "..is not currently supported" instead of "..is not supported" and have a discussion in another issue re: allowing size 0 chunks. I'm also happy to have this PR on hold until we've figured out whether or not we intend to support size 0 chunks or not
Codecov Report
Merging #457 (ca8b511) into main (f9581cb) will decrease coverage by
0.01%. Report is 196 commits behind head on main. The diff coverage is100.00%.
:exclamation: Current head ca8b511 differs from pull request most recent head aa8748d. Consider uploading reports for the commit aa8748d to get more accurate results
Additional details and impacted files
@@ Coverage Diff @@
## main #457 +/- ##
==========================================
- Coverage 99.95% 99.94% -0.01%
==========================================
Files 36 28 -8
Lines 14142 10291 -3851
==========================================
- Hits 14135 10285 -3850
+ Misses 7 6 -1
| Files | Coverage Δ | |
|---|---|---|
| zarr/tests/test_util.py | 100.00% <100.00%> (ø) |
|
| zarr/util.py | 100.00% <100.00%> (ø) |
Things are green again here. FWIW I'm also missing the need to support 0-dimensions, but I assume it helps with numpy compatibility. https://github.com/zarr-developers/zarr-python/commit/445893ce53bcd519360686d5bf7f186518b14391 might be an option to deal with @jakirkham's comment.
Added a small test to ensure empty arrays can be created without issues.
This has unfortunately gone stale. Seems like it was very close. Will it be revived or should we close this?
cc @jrbourbeau and @jakirkham
Closing this out as stale. We'll keep the feature request open.