Skip to content

Commit c44c949

Browse files
committed
Add xarray dependencies for doctest
1 parent de1daed commit c44c949

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

.github/workflows/ci-linux.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
run: |
5151
conda activate env
5252
export DISABLE_NUMCODECS_AVX2=""
53-
python -m pip install -v -e .[test,test_extras,msgpack,zfpy,pcodec]
53+
python -m pip install -v -e .[test,test_extras,doctest,msgpack,zfpy,pcodec]
5454
5555
- name: List installed packages
5656
shell: "bash -l {0}"

.github/workflows/ci-osx.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
run: |
5151
conda activate env
5252
export DISABLE_NUMCODECS_AVX2=""
53-
python -m pip install -v -e .[test,test_extras,msgpack,zfpy,pcodec]
53+
python -m pip install -v -e .[test,test_extras,doctest,msgpack,zfpy,pcodec]
5454
5555
- name: List installed packages
5656
shell: "bash -l {0}"

.github/workflows/ci-windows.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
shell: "bash -l {0}"
4343
run: |
4444
conda activate env
45-
python -m pip install -v -e .[test,test_extras,msgpack,zfpy,pcodec]
45+
python -m pip install -v -e .[test,test_extras,doctest,msgpack,zfpy,pcodec]
4646
4747
- name: List installed packages
4848
shell: "bash -l {0}"

numcodecs/bitinfo.py

+8-4
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

+5
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)