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 docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ Bug fixes
* NestedDirectoryStore.listdir now returns chunk keys with the correct '/' dimension_separator.
By :user:`Brett Graham <braingram>` :issue:`1334`.

* N5Store/N5FSStore dtype returns zarr Stores readable dtype.
By :user:`Marwan Zouinkhi <mzouink>` :issue:`1339`.

.. _release_2.13.6:

2.13.6
Expand Down
1 change: 1 addition & 0 deletions zarr/n5.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ def array_metadata_to_zarr(array_metadata: Dict[str, Any],
array_metadata['order'] = 'C'
array_metadata['filters'] = []
array_metadata['dimension_separator'] = '.'
array_metadata['dtype'] = np.dtype(array_metadata['dtype']).str

compressor_config = array_metadata['compressor']
compressor_config = compressor_config_to_zarr(compressor_config)
Expand Down
13 changes: 6 additions & 7 deletions zarr/tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2034,13 +2034,12 @@ def test_compressors(self):
assert np.all(a2[:] == 1)

def expected(self):
return [
'4e9cf910000506455f82a70938a272a3fce932e5',
'f9d4cbf1402901f63dea7acf764d2546e4b6aa38',
'1d8199f5f7b70d61aa0d29cc375212c3df07d50a',
'874880f91aa6736825584509144afe6b06b0c05c',
'e2258fedc74752196a8c8383db49e27193c995e2',
]
return ['8811a77d54caaa1901d5cc4452d946ae433c8d90',
'd880b007d9779db5f2cdbe13274eb1cbac4a425a',
'd80eb66d5521744f051e816ab368d8ccfc2e3edf',
'568f9f837e4b682a3819cb122988e2eebeb6572b',
'4fdf4475d786d6694110db5619acd30c80dfc372'
]


@pytest.mark.skipif(have_fsspec is False, reason="needs fsspec")
Expand Down
21 changes: 19 additions & 2 deletions zarr/tests/test_n5.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@

import pytest

from zarr.n5 import N5ChunkWrapper
from zarr.n5 import N5ChunkWrapper, N5FSStore
from zarr.creation import create
from zarr.storage import atexit_rmtree
from numcodecs import GZip
import numpy as np
from typing import Tuple
import json
import atexit

from zarr.tests.util import have_fsspec


def test_make_n5_chunk_wrapper():
Expand Down Expand Up @@ -35,3 +40,15 @@ def test_partial_chunk_decode(chunk_shape: Tuple[int, ...]):
chunk[subslices] = 1
subchunk = np.ascontiguousarray(chunk[subslices])
assert np.array_equal(codec_wrapped.decode(codec_wrapped.encode(subchunk)), chunk)


@pytest.mark.skipif(have_fsspec is False, reason="needs fsspec")
def test_dtype_decode():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test will need the fsspec check:

@pytest.mark.skipif(have_fsspec is False, reason="needs fsspec")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! i didn't know how to do it. i added it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers!

path = 'data/array.n5'
atexit_rmtree(path)
atexit.register(atexit_rmtree, path)
n5_store = N5FSStore(path)
create(100, store=n5_store)
dtype_n5 = json.loads(n5_store[".zarray"])["dtype"]
dtype_zarr = json.loads(create(100).store[".zarray"])["dtype"]
assert dtype_n5 == dtype_zarr