Skip to content

Add nrefs() method to VirtualiZarrDatasetAccessor#1029

Merged
TomNicholas merged 10 commits into
zarr-developers:mainfrom
maitriupadhyay03-cell:feat/add-nrefs-accessor
Jun 26, 2026
Merged

Add nrefs() method to VirtualiZarrDatasetAccessor#1029
TomNicholas merged 10 commits into
zarr-developers:mainfrom
maitriupadhyay03-cell:feat/add-nrefs-accessor

Conversation

@maitriupadhyay03-cell

@maitriupadhyay03-cell maitriupadhyay03-cell commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What I did

Adds a nrefs() method to VirtualiZarrDatasetAccessor that returns the total number of virtual chunk references in a dataset, ignoring non-virtual (loadable) variables. Useful for knowing how many references you're about to write to Icechunk or Kerchunk before actually doing it.

The implementation follows the same pattern as the existing .nbytes property.

Acceptance criteria:

maitriupadhyay03-cell and others added 5 commits June 26, 2026 00:38
Add method to count total virtual chunk references in dataset.
Add test for nrefs in open_virtual_dataset with HDFParser.
Added nrefs property to VirtualiZarrDatasetAccessor documentation.
Added a new feature to return the total number of virtual chunk references in the dataset.
Updated doctest to skip for nrefs property.

@TomNicholas TomNicholas left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thank you!

Comment thread virtualizarr/tests/test_xarray.py Outdated
Co-authored-by: Tom Nicholas <tom@earthmover.io>
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.07%. Comparing base (a1fa95c) to head (cbb718f).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1029      +/-   ##
==========================================
+ Coverage   90.01%   90.07%   +0.05%     
==========================================
  Files          36       36              
  Lines        2204     2206       +2     
==========================================
+ Hits         1984     1987       +3     
+ Misses        220      219       -1     
Files with missing lines Coverage Δ
virtualizarr/accessor.py 95.74% <100.00%> (+0.09%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TomNicholas TomNicholas merged commit 80edcb4 into zarr-developers:main Jun 26, 2026
17 checks passed
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.

Add .nrefs method to accessor that returns number of virtual chunk references

2 participants