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

gzip compression options not visible via dataset.compression_opts with v2 filter pipelines #64

Open
bnlawrence opened this issue Dec 21, 2024 · 2 comments

Comments

@bnlawrence
Copy link
Collaborator

bnlawrence commented Dec 21, 2024

This issue is exposed by adding a small test to test_filter_pipeline_v2

def test_filter_pipeline_compression_opts_v2():

     with pyfive.File(FILTER_PIPELINE_V2_FILE) as hfile:
        assert 'data' in hfile
        d = hfile['data']
        # the point of this test is to ensure we can actually retrieve the compression opts
        x = d.compression_opts

This will fail with

  @property
    def compression_opts(self):
        """ Compression filter options, None is no options/compression. """
        if self._filter_ids is None:
            return None
        if GZIP_DEFLATE_FILTER in self._filter_ids:
            gzip_entry = [d for d in self.filter_pipeline
                          if d['filter_id'] == GZIP_DEFLATE_FILTER][0]
>           return gzip_entry['client_data'][0]
E           KeyError: 'client_data'

pyfive/dataobjects.py:324: KeyError

which I think happens because the v2 spec has only client_data_values not client_data in this dictionary (to be clear, I do not know what the spec has, cause I can't find the details of this bit, but by inspection, this is the difference.)

@bnlawrence
Copy link
Collaborator Author

bnlawrence commented Dec 21, 2024

So for example, this is what gzip_entry looks like in test_compressed_dataset:

odict_keys(['filter_id', 'name_length', 'flags', 'client_data_values', 'filter_name', 'client_data'])

and this is what it looks like in the test above:

odict_keys(['filter_id', 'optional', 'name', 'client_data_values'])

I would just "fix" this to use client_data_values in both, but I am not sure what is actually going on.

@bnlawrence
Copy link
Collaborator Author

bnlawrence commented Dec 21, 2024

Well, for now, this seems to work, but I don't really know what is going on (well, I know what the option is, but the spec here implies that the filter description should not differ between v1 and v2.

key = {0:'client_data_values',1:'client_data'}['client_data' in gzip_entry]
return gzip_entry[key][0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant