Skip to content

Question about reverse mapping from key to slice. #971

Description

@JoOkuma

Hi, I'm not sure what's the best place to ask zarr questions so I'm posting this here.

I'm trying to iterate as fast as possible over a zarr.Array with very few chunks initialized.
I couldn't find a method for this so I'm implementing my own function that will return a sequence of chunks and their respective slices.

I started with this function to get the chunks' key:

def get_initialized_keys(array: Array):
    # key pattern for chunk keys
    prog = re.compile(r'\.'.join([r'\d+'] * min(1, array.ndim)))

    # yield chunk keys
    for k in listdir(array.chunk_store, array._path):
        if prog.match(k):
            yield k

Is there any API to get the reverse BasicIndexer behavior, so for a given key (chunk_selection) I would get its slice (out_selection)?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions