Skip to content

Commit d11d593

Browse files
committed
fixup! fixup! zarr-v3: filters / compressors -> codecs
1 parent 25692be commit d11d593

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

xarray/backends/zarr.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
from xarray.core.datatree import DataTree
4444

4545

46-
4746
@functools.lru_cache
4847
def _zarr_v3() -> bool:
4948
try:
@@ -90,8 +89,10 @@ def __init__(self, zarr_array):
9089
self.shape = self._array.shape
9190

9291
# 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])
9596
):
9697
dtype = coding.strings.create_vlen_dtype(str)
9798
else:
@@ -634,17 +635,23 @@ def open_store_variable(self, name, zarr_array=None):
634635
}
635636

636637
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+
]
638641
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+
)
643648
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+
)
648655

649656
# _FillValue needs to be in attributes, not encoding, so it will get
650657
# picked up by decode_cf

0 commit comments

Comments
 (0)