Add open_dataarray to BackendEntrypoint?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
Is your feature request related to a problem?
The BackendEntrypoint class at https://github.com/pydata/xarray/blob/1424972aec3d345a77daea182f6ca0239cb3497d/xarray/backends/common.py#L660-L738 currently has open_dataset and open_datatree methods, but not open_dataarray. Currently, someone implementing a BackendEntrypoint to do xarray.open_dataarray(..., engine="<something>") would have to implement open_dataset, and behind the scenes, this could result in a roundtrip xr.DataArray -> xr.Dataset -> xr.DataArray conversion, which can lead to some attributes/state getting lost along the way (xref https://github.com/pydata/xarray/issues/3268).
Describe the solution you'd like
Enable open_dataarray to be implemented directly, without a roundtrip conversion to/from xr.Dataset
Describe alternatives you've considered
No response
Additional context
https://github.com/GenericMappingTools/pygmt/pull/4008#discussion_r2224256129
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in xarray/backends/common.py at the BackendEntrypoint class and read the existing open_dataset and open_datatree methods. Trace the xarray.open_dataarray engine path to understand where the backend entry point is selected. Done means a backend can provide open_dataarray directly without the DataArray-to-Dataset-to-DataArray roundtrip, with relevant behavior covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100