zarr-python icon indicating copy to clipboard operation
zarr-python copied to clipboard

Raise informative error when chunk size 0

Open jrbourbeau opened this issue 6 years ago • 7 comments
trafficstars

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)

jrbourbeau avatar Jul 19 '19 20:07 jrbourbeau

Gentle ping @alimanfoo @jakirkham whenever you get a moment post-CZI application madness ; )

jrbourbeau avatar Aug 02 '19 19:08 jrbourbeau

Thanks @jrbourbeau, I'll take a look first thing next week :-)

alimanfoo avatar Aug 02 '19 22:08 alimanfoo

What if we have an array with shape (4, 0)? Should we allow a size 0 chunk in this case?

jakirkham avatar Aug 05 '19 10:08 jakirkham

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

jrbourbeau avatar Aug 16 '19 20:08 jrbourbeau

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 is 100.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%> (ø)

... and 29 files with indirect coverage changes

codecov[bot] avatar Feb 18 '21 17:02 codecov[bot]

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.

joshmoore avatar Feb 18 '21 17:02 joshmoore

Added a small test to ensure empty arrays can be created without issues.

jakirkham avatar Oct 12 '22 20:10 jakirkham

This has unfortunately gone stale. Seems like it was very close. Will it be revived or should we close this?

cc @jrbourbeau and @jakirkham

jhamman avatar Dec 07 '23 22:12 jhamman

Closing this out as stale. We'll keep the feature request open.

jhamman avatar Feb 13 '24 22:02 jhamman