Skip to content

Fix handling of scalar Zarr v3 arrays with None dimension_names#897

Merged
maxrjones merged 7 commits intozarr-developers:mainfrom
larsbuntemeyer:fix-zarr3-0-dim
Apr 8, 2026
Merged

Fix handling of scalar Zarr v3 arrays with None dimension_names#897
maxrjones merged 7 commits intozarr-developers:mainfrom
larsbuntemeyer:fix-zarr3-0-dim

Conversation

@larsbuntemeyer
Copy link
Copy Markdown
Contributor

@larsbuntemeyer larsbuntemeyer commented Mar 2, 2026

Addiing tiny fix as in xarray (i peeked again :))

@larsbuntemeyer larsbuntemeyer changed the title handle dimension_names is None Fix handling of scalar Zarr v3 arrays with None dimension_names Mar 2, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 9, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #897      +/-   ##
==========================================
+ Coverage   89.29%   89.31%   +0.02%     
==========================================
  Files          33       33              
  Lines        2036     2040       +4     
==========================================
+ Hits         1818     1822       +4     
  Misses        218      218              
Files with missing lines Coverage Δ
virtualizarr/manifests/array.py 84.37% <100.00%> (+0.67%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@larsbuntemeyer larsbuntemeyer marked this pull request as ready for review March 10, 2026 09:30
@larsbuntemeyer
Copy link
Copy Markdown
Contributor Author

I'm not sure if this needs testing?

Comment thread virtualizarr/manifests/array.py Outdated
@maxrjones
Copy link
Copy Markdown
Member

Thanks for working on this!

I'm not sure if this needs testing?

Yes, please include a test to make sure the fix isn't lost in the future.

as a suggestion:

def test_to_xarray_scalar_no_dimension_names(array_v3_metadata):
    metadata = array_v3_metadata(
        shape=(),
        chunks=(),
        dimension_names=None,
    )
    manifest = ChunkManifest(entries={"c": {"path": "/foo.nc", "offset": 0, "length": 8}})
    marr = ManifestArray(metadata=metadata, chunkmanifest=manifest)

    vv = marr.to_virtual_variable()
    assert vv.dims == ()


def test_to_xarray_nonscalar_no_dimension_names(array_v3_metadata):
    metadata = array_v3_metadata(
        shape=(5,),
        chunks=(5,),
        dimension_names=None,
    )
    manifest = ChunkManifest(entries={"0": {"path": "/foo.nc", "offset": 0, "length": 40}})
    marr = ManifestArray(metadata=metadata, chunkmanifest=manifest)

    with pytest.raises(ValueError, match="without dimension names"):
        marr.to_virtual_variable()

larsbuntemeyer and others added 2 commits April 6, 2026 18:36
Co-authored-by: Max Jones <14077947+maxrjones@users.noreply.github.com>
@maxrjones
Copy link
Copy Markdown
Member

the failures are unrelated so I'm going to approve and merge this. thanks @larsbuntemeyer!

@maxrjones maxrjones merged commit 42cf032 into zarr-developers:main Apr 8, 2026
14 of 18 checks passed
@larsbuntemeyer
Copy link
Copy Markdown
Contributor Author

Thanks for the guidance!!

@larsbuntemeyer larsbuntemeyer deleted the fix-zarr3-0-dim branch April 13, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can not open zarr v3 datasets with scalar variables

3 participants