|
4 | 4 | from pathlib import Path, PurePosixPath |
5 | 5 | from typing import Optional, Union, Tuple, Dict |
6 | 6 | from packaging import version |
| 7 | +import warnings |
7 | 8 |
|
8 | 9 | if sys.version_info < (3, 10): |
9 | 10 | import importlib_metadata |
@@ -197,7 +198,7 @@ def to_ngff_zarr( |
197 | 198 | :param progress: Optional progress logger |
198 | 199 | :type progress: RichDaskProgress |
199 | 200 |
|
200 | | - :param chunks_per_shard: Number of chunks along each axis in a shard. If None, no sharding. Requires zarr version >= 0.5. |
| 201 | + :param chunks_per_shard: Number of chunks along each axis in a shard. If None, no sharding. Requires OME-Zarr version >= 0.5. |
201 | 202 | :type chunks_per_shard: int, tuple, or dict, optional |
202 | 203 |
|
203 | 204 | :param **kwargs: Passed to the zarr.creation.create() function, e.g., compression options. |
@@ -609,4 +610,10 @@ def to_ngff_zarr( |
609 | 610 | callback() |
610 | 611 | image.computed_callbacks = [] |
611 | 612 |
|
612 | | - zarr.consolidate_metadata(store, **format_kwargs) |
| 613 | + if zarr_version_major >= 3: |
| 614 | + with warnings.catch_warnings(): |
| 615 | + # Ignore consolidated metadata warning |
| 616 | + warnings.filterwarnings("ignore", category=UserWarning) |
| 617 | + zarr.consolidate_metadata(store, **format_kwargs) |
| 618 | + else: |
| 619 | + zarr.consolidate_metadata(store, **format_kwargs) |
0 commit comments