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.
Summary
Follow-up from PR #10742 (async DataTree loading optimization). As suggested by @keewis in the PR review:
Current State
After #10742, the zarr backend has two similar async implementations:
_open_datatree_from_stores_async()- used byopen_datatree()open_groups_as_dict_async()- used byopen_groups()Both do similar work but with some differences:
Proposed Change
Refactor
_open_datatree_from_stores_asyncto internally callopen_groups_as_dict_async, reducing code duplication and ensuring consistent behavior between the two APIs.