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