|
43 | 43 | from xarray.core.datatree import DataTree
|
44 | 44 |
|
45 | 45 |
|
46 |
| - |
47 | 46 | @functools.lru_cache
|
48 | 47 | def _zarr_v3() -> bool:
|
49 | 48 | try:
|
@@ -89,8 +88,10 @@ def __init__(self, zarr_array):
|
89 | 88 | self.shape = self._array.shape
|
90 | 89 |
|
91 | 90 | # preserve vlen string object dtype (GH 7328)
|
92 |
| - if not _zarr_v3() and self._array.filters is not None and any( |
93 |
| - [filt.codec_id == "vlen-utf8" for filt in self._array.filters] |
| 91 | + if ( |
| 92 | + not _zarr_v3() |
| 93 | + and self._array.filters is not None |
| 94 | + and any([filt.codec_id == "vlen-utf8" for filt in self._array.filters]) |
94 | 95 | ):
|
95 | 96 | dtype = coding.strings.create_vlen_dtype(str)
|
96 | 97 | else:
|
@@ -633,17 +634,23 @@ def open_store_variable(self, name, zarr_array=None):
|
633 | 634 | }
|
634 | 635 |
|
635 | 636 | if _zarr_v3() and zarr_array.metadata.zarr_format == 3:
|
636 |
| - encoding["codec_pipeline"] = [x.to_dict() for x in zarr_array.metadata.codecs] |
| 637 | + encoding["codec_pipeline"] = [ |
| 638 | + x.to_dict() for x in zarr_array.metadata.codecs |
| 639 | + ] |
637 | 640 | elif _zarr_v3():
|
638 |
| - encoding.update({ |
639 |
| - "compressor": zarr_array.metadata.compressor, |
640 |
| - "filters": zarr_array.metadata.filters, |
641 |
| - }) |
| 641 | + encoding.update( |
| 642 | + { |
| 643 | + "compressor": zarr_array.metadata.compressor, |
| 644 | + "filters": zarr_array.metadata.filters, |
| 645 | + } |
| 646 | + ) |
642 | 647 | else:
|
643 |
| - encoding.update({ |
644 |
| - "compressor": zarr_array.compressor, |
645 |
| - "filters": zarr_array.filters, |
646 |
| - }) |
| 648 | + encoding.update( |
| 649 | + { |
| 650 | + "compressor": zarr_array.compressor, |
| 651 | + "filters": zarr_array.filters, |
| 652 | + } |
| 653 | + ) |
647 | 654 |
|
648 | 655 | # _FillValue needs to be in attributes, not encoding, so it will get
|
649 | 656 | # picked up by decode_cf
|
|
0 commit comments