Skip to content

Commit

Permalink
Set gzip compression properly for zarr
Browse files Browse the repository at this point in the history
Fixes #105.
  • Loading branch information
constantinpape committed Aug 5, 2019
1 parent 8ec2ff7 commit 9dab916
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
10 changes: 5 additions & 5 deletions include/z5/metadata.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ namespace z5 {
throw std::runtime_error("z5.DatasetMetadata.fromJsonZarr: wrong compressor for zarr format");
}

if(zarrCompressorId == "zlib") {
compressionOptions["useZlib"] = true;
} else if (zarrCompressorId == "gzip") {
compressionOptions["useZlib"] = false;
}
types::readZarrCompressionOptionsFromJson(compressor, compressionOpts,
compressionOptions);
// we need to do this after 'readZarrCompressionOptionsFromJson' is called,
// because otherwise this will be overriden
if (zarrCompressorId == "gzip") {
compressionOptions["useZlib"] = false;
}
}


Expand Down
3 changes: 0 additions & 3 deletions src/python/test/test_zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def test_write_zarr_irregular(self):
def test_read_zarr(self):
from z5py.dataset import Dataset
dtypes = list(Dataset._zarr_dtype_dict.values())
compressions = Dataset.compressors_zarr
zarr_compressors = {'blosc': numcodecs.Blosc(),
'zlib': numcodecs.Zlib(),
'raw': None,
Expand All @@ -87,8 +86,6 @@ def test_read_zarr(self):
self.assertEqual(data.shape, out.shape)
self.assertTrue(np.allclose(data, out))

# zarr gzip compression is not working properly yet
@unittest.expectedFailure
@unittest.skipUnless(HAVE_ZARR, 'Requires zarr package')
def test_write_zarr(self):
from z5py.dataset import Dataset
Expand Down

0 comments on commit 9dab916

Please sign in to comment.