-
-
Notifications
You must be signed in to change notification settings - Fork 369
Provide chunk_grid_space fallback in _iter_shard_coords
#3614
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
|
we need separate methods for iterating over chunks and shards because they are not the same # /// script
# requires-python = ">=3.11"
# dependencies = [
# "zarr@git+https://github.com/zarr-developers/zarr-python.git@main",
# ]
# ///
import zarr
array = zarr.create_array({} ,shape=(10,), dtype='i4', chunks=(5,), shards=(10,), fill_value=0)
print(tuple(array._iter_shard_regions()))
# ((slice(0, 10, 1),),)
print(tuple(array._iter_chunk_regions()))
# ((slice(0, 5, 1),), (slice(5, 10, 1),)) |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3614 +/- ##
==========================================
- Coverage 59.14% 59.14% -0.01%
==========================================
Files 86 86
Lines 10172 10174 +2
==========================================
+ Hits 6016 6017 +1
- Misses 4156 4157 +1
🚀 New features to boost your workflow:
|
|
I see that, but do not see where this is used internally that it matters. Otherwise I would just provide the same fallback option for |
|
we do not use these methods internally yet, but that's not a good reason for removing them. also see #3573 |
Then I will revert them, but provide just the same fallback option for `_iter_shard_coords' |
_iter_shard_coords
|
I'm confused by these changes -- is there a bug that this fixes? Because we should already fall back to the chunk grid for unsharded v2 arrays, via the |
|
Thanks @d-v-b for your patience and pointing it out. Was mainly based on spotting it based on the other method. |
In the codebase
_iter_shard_regionswas already falling back to chunks in case there are no shards. Another method,iter_shard_coordsdid not have this fallback option. This PR adds a fallback uption for that method in case there is no shard grid.TODO:
changes/@d-v-b @joshmoore