Skip to content

Commit 5a57ef7

Browse files
committed
Add extra docs to CodecStack.encode_decode_data_array
1 parent 1b47bd2 commit 5a57ef7

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ on:
66
- main
77
pull_request:
88
branches:
9-
- '*'
9+
- "*"
10+
11+
env:
12+
CLICOLOR: 1
1013

1114
jobs:
1215
check:
@@ -21,6 +24,16 @@ jobs:
2124
with:
2225
args: check
2326

27+
spelling:
28+
name: Spellcheck
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout the Repository
32+
uses: actions/checkout@v4
33+
34+
- name: Spellcheck repo
35+
uses: crate-ci/typos@v1.32.0
36+
2437
fmt:
2538
name: Formatting
2639
runs-on: ubuntu-latest
@@ -50,7 +63,7 @@ jobs:
5063
run: uv sync --all-extras --dev && uv pip install .
5164

5265
- name: Run tests
53-
run: uv run pytest
66+
run: uv run pytest -v -W error
5467

5568
mypy:
5669
name: Typecheck

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "numcodecs-combinators"
7-
version = "0.2.7"
7+
version = "0.2.8"
88
description = "Combinator codecs for the `numcodecs` buffer compression API"
99
readme = "README.md"
1010
license = { file = "LICENSE" }

src/numcodecs_combinators/stack.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,14 @@ def encode_decode(self, buf: Buffer) -> Buffer:
167167

168168
def encode_decode_data_array(self, da: "xr.DataArray") -> "xr.DataArray":
169169
"""
170-
Encode, then decode the data array in `da`.
170+
Encode, then decode each chunk (independently) in the data array `da`.
171+
172+
Since each chunk is encoded *independently*, this method may cause
173+
chunk boundary artifacts. Do *not* use this method if the codec
174+
requires access to the entire data at once or if it needs to access
175+
a neighbourhood of points across the chunk boundary. In these cases,
176+
it is preferable to use
177+
`da.copy(data=stack.encode_decode(da.values))` instead.
171178
172179
The encode-decode computation may be deferred until the
173180
[`compute`][xarray.DataArray.compute] method is called on the result.

0 commit comments

Comments
 (0)