Skip to content

feat: add cast_value and scale_offset codecs#3874

Open
d-v-b wants to merge 9 commits intozarr-developers:mainfrom
d-v-b:feat/scale-offset-cast-value
Open

feat: add cast_value and scale_offset codecs#3874
d-v-b wants to merge 9 commits intozarr-developers:mainfrom
d-v-b:feat/scale-offset-cast-value

Conversation

@d-v-b
Copy link
Copy Markdown
Contributor

@d-v-b d-v-b commented Apr 6, 2026

Defines two new codecs that together provide a v3-native replacement for the existing numcodecs.fixedscaleoffset codec.

The cast_value codec requires an optional dependency on the cast-value-rs package. The reason for bringing in rust here is because it gives us better average speed and much better memory usage than a numpy implementation. Happy to show this with benchmarks if needed.

fwiw, I would rather not define these codecs in zarr-python. In fact I already defined these codec classes in another package. But it's not possible to make zarr-python depend on an externally-defined codec without creating a circular dependency, so here we are. See discussion in the related issue.

related, and possibly closes #3867

d-v-b added 2 commits April 6, 2026 14:00
Defines two new codecs that together provide a v3-native replacement for the existing `numcodecs.fixedscaleoffset` codec.
The `cast_value` codec requires an optional dependency on the `cast-value-rs` package.
@d-v-b d-v-b requested a review from TomAugspurger April 6, 2026 12:20
@github-actions github-actions bot added the needs release notes Automatically applied to PRs which haven't added release notes label Apr 6, 2026
@github-actions github-actions bot removed the needs release notes Automatically applied to PRs which haven't added release notes label Apr 6, 2026
@d-v-b
Copy link
Copy Markdown
Contributor Author

d-v-b commented Apr 6, 2026

cc @emmanuelmathot

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 6, 2026

Codecov Report

❌ Patch coverage is 56.49718% with 77 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.41%. Comparing base (c966cfa) to head (3f8cfdb).

Files with missing lines Patch % Lines
src/zarr/codecs/cast_value.py 33.92% 74 Missing ⚠️
src/zarr/codecs/scale_offset.py 95.08% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3874      +/-   ##
==========================================
- Coverage   92.98%   92.41%   -0.57%     
==========================================
  Files          87       89       +2     
  Lines       11246    11423     +177     
==========================================
+ Hits        10457    10557     +100     
- Misses        789      866      +77     
Files with missing lines Coverage Δ
src/zarr/codecs/__init__.py 100.00% <100.00%> (ø)
src/zarr/codecs/scale_offset.py 95.08% <95.08%> (ø)
src/zarr/codecs/cast_value.py 33.92% <33.92%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@d-v-b d-v-b requested a review from a team April 7, 2026 13:38
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.

zarr v3 scale-offset codec, and should the codec API be defined upstream

1 participant