Skip to content

Missing info regarding default compression behavior #45

Closed
@jm9176

Description

@jm9176

In MATLAB, no compression is applied if a user uses a default syntax, e.g. zarrcreate('prt_grp/arr1',[10 10]). However, if I create a zarr array using Python and Zarr library then it uses blosc compression by default. So, there seems to be some difference in default behavior between MATLAB and Python workflow.

So, it would be helpful to clarify this behavior or related differences.

**Python code**
# Create Zarr v2 array
import zarr
import numpy as np
store = zarr.DirectoryStore('prt_grp')
group = zarr.group(store=store,overwrite=True)
group.attrs['group_description'] = 'This is a sample Zarr group'
group.attrs['group_level'] = 1
array = group.create_dataset('arr_1',shape=(20,25),dtype=np.float32,chunks=(2,5),fillvalue=-9)
array.attrs['array_description'] = 'This is a sample Zarr array'
array.attrs['array_type'] = 'double'
array.attrs['array_level'] = 1
array[:] = np.random.rand(20,25)


**zarrinfo output from MATLAB**
>> info = zarrinfo('prt_grp/arr_1');
>> info.compressor

ans = 

  struct with fields:

    blocksize: 0
       clevel: 5
        cname: 'lz4'
           id: 'blosc'
      shuffle: 1


Activity

abhibaruah

abhibaruah commented on May 1, 2025

@abhibaruah
Member

The no compression default for MATLAB is by design (similar to our existing sci data functions).
We do not guarantee same behavior as the Python libraries.
With the PR #75
we will hopefully document this at the right location.

abhibaruah

abhibaruah commented on May 2, 2025

@abhibaruah
Member

Closing this since #75 has been merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jm9176@abhibaruah

        Issue actions

          Missing info regarding default compression behavior · Issue #45 · mathworks/MATLAB-support-for-Zarr-files