Skip to content

Public API for determining if an array is sharded #4036

Open

Description

@maxrjones

Describe the new feature you'd like

Similar to #4035, it would simplify downstream use-cases to have a clear method that indicates if an array uses sharding.

Currently, one can use .shards is not None for regular chunk grids, but must use a try/except for sharded + rectilinear grids since the return type of .shards cannot express rectilinear grids.

See https://hackmd.io/p9pU24IQR6uA9tg6c0wMhw for a full evaluation of the API surface (generated by claude).

Activity

  1. added
    enhancement
    on Jun 4, 2026
  2. d-v-b commented on Jun 4, 2026

    @d-v-b
    Contributor

    we could expose the ChunkLayout. When inner is None, no sharding codec is being used. We would need to update this to accommodate any new codecs that implement sharding.

  3. maxrjones commented on Jun 4, 2026

    @maxrjones
    MemberAuthor

    we could expose the ChunkLayout. When inner is None, no sharding codec is being used. We would need to update this to accommodate any new codecs that implement sharding.

    would it be better to expose ChunkLayout via Zarr's regular API or a metadata package?

  4. d-v-b commented on Jun 4, 2026

    @d-v-b
    Contributor

    I don't think it belongs in a metadata package, since it's something we invented for an internal representation in zarr-python. it's basically a distillation of the chunk grid + codecs for an array, so it's could be useful as an attribute on array metadata, or on the array itself. we might need to polish it a bit, e.g. changing field names

  5. maxrjones commented on Jun 4, 2026

    @maxrjones
    MemberAuthor

    I don't think it belongs in a metadata package, since it's something we invented for an internal representation in zarr-python. it's basically a distillation of the chunk grid + codecs for an array, so it's could be useful as an attribute on array metadata, or on the array itself. we might need to polish it a bit, e.g. changing field names

    makes sense.

    A ChunkLayout attribute could be a logical place to solve #4035 as well.

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions