Skip to content

Commit

Permalink
HARMONY-895: Implement deflate shuffle compression (#6)
Browse files Browse the repository at this point in the history
* HARMONY-895: Implement deflate shuffle compression along with real-world demo
* HARMONY-895: Add DMR++ fixture
* HARMONY-895: Fix tests with explicit test case for deflate shuffle
* HARMONY-895: Add fixture for MUR granule with deflate shuffle compression
* HARMONY-895: Add information about ticket for scale factor and add offset
  • Loading branch information
bilts authored Jul 16, 2021
1 parent 921efc8 commit 12e8bb6
Show file tree
Hide file tree
Showing 4 changed files with 2,228 additions and 4 deletions.
15 changes: 13 additions & 2 deletions eosdis_store/dmrpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ def array_to_zarr(node, dims, prefix=''):
compression = child.attrib.get('compressionType')
if compression == 'deflate':
zarray['compressor'] = { "id": "zlib", "level": UNKNOWN_COMPRESSION_LEVEL }
elif compression == 'deflate shuffle':
zarray['compressor'] = {"id": "zlib", "level": UNKNOWN_COMPRESSION_LEVEL}
size = int(dtype[2:])
zarray['filters'] = [{"id": "shuffle", "elementsize": size}]
elif compression is None:
zarray['compressor'] = None
else:
Expand All @@ -210,8 +214,15 @@ def array_to_zarr(node, dims, prefix=''):
# NOTE - this is null in test file
zarray['fill_value'] = zattrs.get('_FillValue')

#if node.attrib['name'] == 'time':
# set_trace()
# HARMONY-896: Automatic scale factor and offset filter. Not yet working with all data types
# if zattrs.get('scale_factor') or zattrs.get('add_offset'):
# zarray['filters'].append({
# 'id': 'fixedscaleoffset',
# 'offset': zattrs.get('add_offset', 0.0),
# 'scale': zattrs.get('scale_factor', 1.0),
# 'dtype': '<f8',
# })

if zarray.get('chunks') is None:
zarray['chunks'] = zarray['shape']

Expand Down
215 changes: 215 additions & 0 deletions presentation/example.ipynb

Large diffs are not rendered by default.

Loading

0 comments on commit 12e8bb6

Please sign in to comment.