Skip to content

Commit

Permalink
fix: zfpy/pcodec metadata handling
Browse files Browse the repository at this point in the history
  • Loading branch information
LDeakin committed Feb 3, 2025
1 parent 59e60fc commit 1a6dc77
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions python/zarrs/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,27 @@ def codecs_to_dict(codecs: Iterable[Codec]) -> Generator[dict[str, Any], None, N
"vlen-array",
"vlen-bytes",
"vlen-utf8",
"zfpy",
"pcodec",
]:
has_array_to_bytes = True
as_dict = {"name": name, "configuration": filter}
yield as_dict
if not has_array_to_bytes:
yield BytesCodec().to_dict()
compressor = {}
if codec_dict.get("compressor", None) is not None:
compressor = codec_dict["compressor"].get_config()
if compressor.get("id", None) == "zstd":
if compressor.get("id") in ["zfpy", "pcodec"]:
has_array_to_bytes = True
if not has_array_to_bytes:
yield BytesCodec().to_dict()
if compressor:
if compressor.get("id") == "zstd":
as_dict = {
"name": "zstd",
"configuration": {
"level": int(compressor["level"]),
"checksum": compressor["checksum"],
},
}
elif compressor.get("id", None) == "blosc":
elif compressor.get("id") == "blosc":
as_dict = {
"name": "blosc",
"configuration": {
Expand Down

0 comments on commit 1a6dc77

Please sign in to comment.