From b7ba6b2c95661853da884933e7edadf740430cf0 Mon Sep 17 00:00:00 2001 From: Bryan Lawrence Date: Tue, 7 Jan 2025 07:28:12 +0000 Subject: [PATCH 1/3] Test which exposes #64 --- tests/test_filter_pipeline_v2.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_filter_pipeline_v2.py b/tests/test_filter_pipeline_v2.py index 9eeb9a3..13172c8 100644 --- a/tests/test_filter_pipeline_v2.py +++ b/tests/test_filter_pipeline_v2.py @@ -17,3 +17,12 @@ def test_filter_pipeline_descr_v2(): d = hfile['data'] assert d.shape == (10,10,10) assert_almost_equal(d[0,0,0], 1.0) + + +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 \ No newline at end of file From ca1b6d6ff7431e45d2c1c8e71bb340e1c6b615cc Mon Sep 17 00:00:00 2001 From: Bryan Lawrence Date: Tue, 7 Jan 2025 07:30:04 +0000 Subject: [PATCH 2/3] Fix for issue #64. --- pyfive/dataobjects.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyfive/dataobjects.py b/pyfive/dataobjects.py index adb19eb..edee0a9 100644 --- a/pyfive/dataobjects.py +++ b/pyfive/dataobjects.py @@ -321,7 +321,8 @@ def compression_opts(self): 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] + key = {0:'client_data_values',1:'client_data'}['client_data' in gzip_entry] + return gzip_entry[key][0] return None @property From cb5a98d1fcb61c0848755f2e14467f8fc2f70236 Mon Sep 17 00:00:00 2001 From: Bryan Lawrence Date: Tue, 7 Jan 2025 08:26:53 +0000 Subject: [PATCH 3/3] With check we get the right compression options value --- tests/test_filter_pipeline_v2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_filter_pipeline_v2.py b/tests/test_filter_pipeline_v2.py index 13172c8..cbbaab3 100644 --- a/tests/test_filter_pipeline_v2.py +++ b/tests/test_filter_pipeline_v2.py @@ -25,4 +25,5 @@ def test_filter_pipeline_compression_opts_v2(): 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 \ No newline at end of file + x = d.compression_opts + assert x == 9 \ No newline at end of file