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

Feature proposal: DataArray.to_zarr() #7692

Closed
jhamman opened this issue Mar 28, 2023 · 5 comments · Fixed by #7693
Closed

Feature proposal: DataArray.to_zarr() #7692

jhamman opened this issue Mar 28, 2023 · 5 comments · Fixed by #7693

Comments

@jhamman
Copy link
Member

jhamman commented Mar 28, 2023

Is your feature request related to a problem?

It would be nice to mimic the behavior of DataArray.to_netcdf for the Zarr backend.

Describe the solution you'd like

This should be possible:

xr.open_dataarray('file.nc').to_zarr('store.zarr')

Describe alternatives you've considered

None.

Additional context

xref DataArray.to_netcdf issue/PR: #915 / #990

@keewis
Copy link
Collaborator

keewis commented Mar 28, 2023

I guess the alternative would be to go with xr.save_dataset / xr.save_dataarray, but that seems like a lot of work (and I agree that since we already have Dataset.to_zarr we can also have DataArray.to_zarr)

@jhamman
Copy link
Member Author

jhamman commented Mar 28, 2023

I was once a fan of the save_dataset route but I think we've opted to stick with the format specific to_ methods.

@keewis
Copy link
Collaborator

keewis commented Mar 28, 2023

As far as I understand #5954 and the meeting notes, we didn't decide anything about that yet (I might be wrong, though). So I assume the only reason we don't have write backends and save_dataset / save_dataarray right now is that nobody got around to doing that yet.

@jhamman
Copy link
Member Author

jhamman commented Mar 28, 2023

Fair enough. I was extrapolating a bit based on the response to #7496. If someone wants to bite off the writable backends task, I'm all for it.

@TomNicholas
Copy link
Contributor

👍 to not having to write to_dataset before saving things.

I think the .to_X vs e.g. .save(engine='X') is important enough that we should think about it a bit more. The response to #7496 doesn't seem conclusive to me (yet).

A twitter poll? Then a discussion in a meeting?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants