Skip to content

open_consolidated doesn't accept enough kwargs #336

Closed
@rabernat

Description

@rabernat

Minimal, reproducible code sample, a copy-pastable example if possible

open_consolidated doesn't accept the same keywords as open_group. This makes it hard to replace open_group with open_consolidated in downstream code (e.g. xarray).

# create a new store
path = 'consolidated-test.zarr'
new_group = zarr.open_group(path, mode='w', synchronizer=None)
a = new_group.create('foo', shape=(10,))
zarr.consolidate_metadata(new_group.store)
group_cons = zarr.open_consolidated(path, mode='r', synchronizer=None)

gives the error

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-17-1eea689b4531> in <module>()
      3 a = new_group.create('foo', shape=(10,))
      4 zarr.consolidate_metadata(new_group.store)
----> 5 group_cons = zarr.open_consolidated(path, mode='r', synchronizer=None)

TypeError: open_consolidated() got an unexpected keyword argument 'synchronizer'

Problem description

The open_consolidated convenience function should pass through any arguments to the underlying open method. Instead, it does this

https://github.com/zarr-developers/zarr/blob/e44c4c5951181c86cc54998d4ddeb221f8059e72/zarr/convenience.py#L1181-L1185

Contrast this with open:

https://github.com/zarr-developers/zarr/blob/e44c4c5951181c86cc54998d4ddeb221f8059e72/zarr/convenience.py#L22-L36

Version and installation information

Zarr version is '2.2.1.dev97'

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

    Issue actions