-
|
I'm trying to use the Is this possible (or even recommended)? Per the API docs, My motivation here is to append along the time axis and to use a context manager to handle the transactions. I'm open to other solutions if a different approach is recommended. storage = icechunk.s3_storage(
bucket="my-bucket",
prefix="my-prefix",
from_env=True,
)
if icechunk.Repository.exists(storage):
repo = icechunk.Repository.open(storage)
else:
repo = icechunk.Repository.create(storage)
with repo.transaction(
"main",
message="My commit message",
rebase_with=icechunk.ConflictDetector(),
) as store:
icechunk.xarray.to_icechunk(
mydf.to_xarray(),
store, # Expects icechunk.Session
append_dim="time"
) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Welcome @pjireland! 👋 The context manager and Option 1: Use Context manager without
|
Beta Was this translation helpful? Give feedback.
Welcome @pjireland! 👋
The context manager and
xarray.to_icechunkare currently mutually exclusive. However,to_icechunkis only required with distributed writes. You have two optionsOption 1: Use Context manager without
to_xarrayOption 2: Use
to_xarraywith Session APIKeep in mind that the context manager is just syntactic sugar over the Session API. The implementation is extremely simple:
icechunk/ice…