Skip to content

fix: scalar variable manifests get shape () not (1,) from kerchunk refs#965

Merged
TomNicholas merged 1 commit intozarr-developers:mainfrom
TomNicholas:fix-scalar-manifest-shape
Apr 13, 2026
Merged

fix: scalar variable manifests get shape () not (1,) from kerchunk refs#965
TomNicholas merged 1 commit intozarr-developers:mainfrom
TomNicholas:fix-scalar-manifest-shape

Conversation

@TomNicholas
Copy link
Copy Markdown
Member

@TomNicholas TomNicholas commented Apr 10, 2026

Closes #966

Summary

  • Kerchunk uses v2-style chunk key "0" for scalar variables, which get_chunk_grid_shape interprets as 1D shape (1,) instead of scalar (). This causes ManifestStore.get_entry to return an ndarray instead of a string when resolving scalar chunk paths, crashing urlparse.
  • Pass the chunk grid shape derived from array metadata into ChunkManifest, so scalar variables get the correct () shape.
  • Handle 0-d array indexing in ChunkManifest.__init__ when shape is ().

Test plan

  • Added test_scalar_variable_manifest_shape — verifies scalar variable from kerchunk refs produces manifest with shape_chunk_grid == ()

@TomNicholas TomNicholas added the Kerchunk Relating to the kerchunk library / specification itself label Apr 10, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.31%. Comparing base (ce729ca) to head (d1cd415).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #965   +/-   ##
=======================================
  Coverage   89.30%   89.31%           
=======================================
  Files          33       33           
  Lines        2039     2031    -8     
=======================================
- Hits         1821     1814    -7     
+ Misses        218      217    -1     
Files with missing lines Coverage Δ
virtualizarr/manifests/manifest.py 86.18% <ø> (ø)
virtualizarr/parsers/kerchunk/translator.py 81.08% <100.00%> (-0.44%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Kerchunk uses v2-style chunk key "0" for scalar variables, which
get_chunk_grid_shape interprets as 1D shape (1,) instead of scalar ().
Pass the chunk grid shape derived from metadata into ChunkManifest so
scalar variables get the correct () shape. Also handle 0-d array
indexing in ChunkManifest.__init__.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@TomNicholas TomNicholas force-pushed the fix-scalar-manifest-shape branch from c5d14c1 to d1cd415 Compare April 10, 2026 21:13
@TomNicholas TomNicholas merged commit 7a9e5fd into zarr-developers:main Apr 13, 2026
18 checks passed
@TomNicholas TomNicholas deleted the fix-scalar-manifest-shape branch April 13, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Kerchunk Relating to the kerchunk library / specification itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scalar variables from kerchunk refs get manifest shape (1,) instead of ()

1 participant