Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changes/4558.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Arrays that apply a Numcodecs `Delta` or `FixedScaleOffset` filter followed by a
`TransposeCodec` now read back the values that were written. The filter now
decodes the transposed chunk in logical (C) order rather than memory order.
2 changes: 1 addition & 1 deletion src/zarr/codecs/numcodecs/_codecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def __init__(self, **codec_config: JSON) -> None:
super().__init__(**codec_config)

def _decode_sync(self, chunk_data: NDBuffer, chunk_spec: ArraySpec) -> NDBuffer:
chunk_ndarray = chunk_data.as_ndarray_like()
chunk_ndarray = np.ascontiguousarray(chunk_data.as_ndarray_like())
out = self._codec.decode(chunk_ndarray)
return chunk_spec.prototype.nd_buffer.from_ndarray_like(out.reshape(chunk_spec.shape))

Expand Down
3 changes: 3 additions & 0 deletions tests/test_codecs/test_numcodecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,11 @@ def test_generic_compressor(codec_class: type[_numcodecs._NumcodecsBytesBytesCod
"astype",
],
)
@pytest.mark.parametrize("transpose", [False, True])
def test_generic_filter(
codec_class: type[_numcodecs._NumcodecsArrayArrayCodec],
codec_config: dict[str, JSON],
transpose: bool,
) -> None:
data = np.linspace(0, 10, 256, dtype="float32").reshape((16, 16))

Expand All @@ -153,6 +155,7 @@ def test_generic_filter(
fill_value=0,
filters=[
codec_class(**codec_config),
*([TransposeCodec(order=(1, 0))] if transpose else []),
],
)

Expand Down
Loading