Skip to content
Discussion options

You must be logged in to vote

Welcome @pjireland! 👋

The context manager and xarray.to_icechunk are currently mutually exclusive. However, to_icechunk is only required with distributed writes. You have two options

Option 1: Use Context manager without to_xarray

with repo.transaction("main", message=message) as store:
    # ds needs to be in memory or using Dask threaded scheduler
    ds.to_zarr(store, zarr_format=3)

Option 2: Use to_xarray with Session API

session = repo.writable_session("main")
icechunk.xarray.to_icechunk(ds, session.store, zarr_format=3)
session.commit("message")

Keep in mind that the context manager is just syntactic sugar over the Session API. The implementation is extremely simple:

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pjireland
Comment options

Answer selected by pjireland
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants