Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change 'compressor' encoding so that it contains 'id' #270

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions xpublish/plugins/included/zarr.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import logging
from typing import Sequence
import copy
from numcodecs.abc import Codec

import cachey # type: ignore
import xarray as xr
Expand Down Expand Up @@ -91,6 +93,13 @@ def get_variable_chunk(

# First check that this request wasn't for variable metadata
if array_meta_key in chunk:
compressor=zmetadata['metadata'][f'{var}/{array_meta_key}'].get("compressor")
if compressor and isinstance(compressor,Codec):
correct_comprdict=compressor.get_config()
newzmeta=copy.deepcopy(zmetadata['metadata'][f'{var}/{array_meta_key}'])
del newzmeta['compressor']
newzmeta['compressor']=correct_comprdict
return newzmeta
return zmetadata['metadata'][f'{var}/{array_meta_key}']
elif attrs_key in chunk:
return JSONResponse(zmetadata['metadata'][f'{var}/{attrs_key}'])
Expand Down