Skip to content

Refactor async datatree loading to reuse open_groups_as_dict_async #11131

@aladinor

Description

@aladinor

Summary

Follow-up from PR #10742 (async DataTree loading optimization). As suggested by @keewis in the PR review:

logically I think xr.open_datatree(...) == xr.DataTree.from_dict(xr.open_groups(...)), so it might make sense to have _open_datatree_async call _open_groups_as_dict_async

Current State

After #10742, the zarr backend has two similar async implementations:

  • _open_datatree_from_stores_async() - used by open_datatree()
  • open_groups_as_dict_async() - used by open_groups()

Both do similar work but with some differences:

  • Semaphore usage for concurrency control
  • Index creation handling

Proposed Change

Refactor _open_datatree_from_stores_async to internally call open_groups_as_dict_async, reducing code duplication and ensuring consistent behavior between the two APIs.

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