Skip to content

Port v2 filters to v3 and add the scale_offset codec - #350

Draft
asinghvi17 wants to merge 1 commit into
mainfrom
feat/v3-filter-codecs
Draft

asinghvi17 wants to merge 1 commit into
mainfrom
feat/v3-filter-codecs

Conversation

@asinghvi17

@asinghvi17 asinghvi17 commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

First part of #346, addressing this comment.

  • v2 filters (delta, fixedscaleoffset, quantize, shuffle, fletcher32) are readable and writable as zarr-python's numcodecs.<id> v3 codecs, wrapped in FilterCodec. zcreate(...; zarr_format=3, filters) now uses them.
  • Adds the scale_offset codec as ScaleOffset.
  • Array->array codecs can change the element type through encoded_type.
  • Fixes getfilter for delta and quantize, which dropped astype.

Tested round trips against zarr-python 3.4 in both directions.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LH4S6Dry2jRaisNvj7dWU1

v2 filters are readable and writable as zarr-python's `numcodecs.<id>` v3
codecs through `FilterCodec`, and `zcreate(...; zarr_format=3, filters)`
now uses them. Codecs may change the element type via `encoded_type`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LH4S6Dry2jRaisNvj7dWU1
@asinghvi17
asinghvi17 added this pull request to stack #352 September 30, 2026 20:03
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 36769972476

Coverage increased (+0.08%) to 90.567%

Details

  • Coverage increased (+0.08%) from the base build.
  • Patch coverage: 2 uncovered changes across 1 file (42 of 44 lines covered, 95.45%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
ZarrCore/src/Codecs/V3/V3.jl 14 12 85.71%
Total (6 files) 44 42 95.45%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
ZarrCore/src/Filters/quantize.jl 1 85.0%

Coverage Stats

Coverage Status
Relevant Lines: 2046
Covered Lines: 1853
Line Coverage: 90.57%
Coverage Strength: 5733.22 hits per line

💛 - Coveralls

The zarr v3 `scale_offset` array->array codec: encodes `(x - offset) * scale`
and decodes `x / scale + offset` in the array's element type.
"""
struct ScaleOffset{S<:Real} <: V3Codec{:array, :array}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this should be ScaleOffsetCodec in line with the rest...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@meggart worth a look here, not sure if this is necessarily what we want

This branch has not been deployed

No deployments
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.

2 participants