Skip to content

Commit 50c6b48

Browse files
committed
update imagecodecs example
1 parent a2bc655 commit 50c6b48

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

examples/image_codecs.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# /// script
22
# requires-python = ">=3.11"
33
# dependencies = [
4-
# "zarr @ file:///home/bennettd/dev/zarr-python/",
4+
# "zarr @ git+https://github.com/d-v-b/zarr-python.git@a2bc6555",
55
# "imagecodecs==2025.3.30",
66
# "pytest"
77
# ]
@@ -25,21 +25,22 @@
2525
def test(zarr_format: Literal[2, 3]) -> None:
2626
store = {}
2727
if zarr_format == 2:
28-
zarr.create_array(
28+
z_w = zarr.create_array(
2929
store=store,
3030
data=np.zeros((100, 100, 3), dtype=np.uint8),
3131
compressors=jpg_codec,
3232
zarr_format=zarr_format,
3333
)
3434
else:
35-
zarr.create_array(
35+
z_w = zarr.create_array(
3636
store=store,
3737
data=np.zeros((100, 100, 3), dtype=np.uint8),
3838
serializer=jpg_codec,
3939
zarr_format=zarr_format,
4040
)
41-
41+
z_w[:] = 2
4242
z_r = zarr.open_array(store=store, zarr_format=zarr_format)
43+
assert np.all(z_r[:] == 2)
4344
if zarr_format == 2:
4445
print(z_r.metadata.to_dict()["compressor"])
4546
else:

0 commit comments

Comments
 (0)