Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow data instantiation from a xarray.DataArray object #706

Closed
davidhassell opened this issue Jan 10, 2024 · 0 comments · Fixed by #711
Closed

Allow data instantiation from a xarray.DataArray object #706

davidhassell opened this issue Jan 10, 2024 · 0 comments · Fixed by #711
Labels
enhancement New feature or request
Milestone

Comments

@davidhassell
Copy link
Collaborator

At v3.16.0, a passing an xarray.DataAarray object in as the array of a cf.Data object works, insofar as it doesn't fail. However, because the xarray object claims (or might claim) to be a Dask collection (i.e. dask.base.is_dask_collection(<xarray.DataArray>) is True), the xarray object could be stored internally in place of the expected Dask array.

The solution is to test for a xarray.Datarray inputs and convert it to a Dask array as appropriate.

Dask has some prior art on this, e.g. https://github.com/dask/dask/blob/2023.12.1/dask/array/core.py#L4569-L4570

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant