Skip to content

Commit 27c119f

Browse files
committed
Add xarray dependencies for doctest
1 parent 46e0d68 commit 27c119f

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

.github/workflows/ci-linux.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
run: |
5252
conda activate env
5353
export DISABLE_NUMCODECS_AVX2=""
54-
python -m pip install -v -e .[test,test_extras,msgpack,zfpy,pcodec]
54+
python -m pip install -v -e .[test,test_extras,doctest,msgpack,zfpy,pcodec]
5555
5656
- name: List installed packages
5757
shell: "bash -l {0}"

.github/workflows/ci-osx.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
run: |
5252
conda activate env
5353
export DISABLE_NUMCODECS_AVX2=""
54-
python -m pip install -v -e .[test,test_extras,msgpack,zfpy,pcodec]
54+
python -m pip install -v -e .[test,test_extras,doctest,msgpack,zfpy,pcodec]
5555
5656
- name: List installed packages
5757
shell: "bash -l {0}"

.github/workflows/ci-windows.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
shell: "bash -l {0}"
4444
run: |
4545
conda activate env
46-
python -m pip install -v -e .[test,test_extras,msgpack,zfpy,pcodec]
46+
python -m pip install -v -e .[test,test_extras,doctest,msgpack,zfpy,pcodec]
4747
4848
- name: List installed packages
4949
shell: "bash -l {0}"

numcodecs/bitinfo.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,20 @@ class BitInfo(BitRound):
3333
3434
Examples
3535
--------
36+
This example applies the BitInfo codec to an xarray dataset and
37+
writes the data out using xarray's `to_zarr` method. Using this pattern, the
38+
information content is computed chunkwise, which is recommended for
39+
datasets with variable information content. Note that these data have
40+
been quantized creating erroneous results, which is apparent in
41+
the output. Do not use with quantized data in practice.
42+
3643
>>> import xarray as xr
3744
>>> ds = xr.tutorial.open_dataset("air_temperature")
38-
>>> # Note these data have already undergone lossy compression,
39-
>>> # which should not be combined with bitinformation in practice
40-
4145
>>> from numcodecs import Blosc, BitInfo
4246
>>> compressor = Blosc(cname="zstd", clevel=3)
4347
>>> filters = [BitInfo(info_level=0.99)]
4448
>>> encoding = {"air": {"compressor": compressor, "filters": filters}}
45-
>>> ds.to_zarr('xbit.zarr', mode="w", encoding=encoding)
49+
>>> _ = ds.to_zarr('xbit.zarr', mode="w", encoding=encoding)
4650
"""
4751

4852
codec_id = 'bitinfo'

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ test = [
5959
]
6060
test_extras = [
6161
"importlib_metadata",
62+
]
63+
doctest = [
6264
"xarray",
65+
"pooch",
66+
"netCDF4",
67+
"zarr",
6368
]
6469
msgpack = [
6570
"msgpack",

0 commit comments

Comments
 (0)