You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Surface mode in to_icechunk, keeping current defaults
Add a mode parameter ("w", "w-", "a") to vds.vz.to_icechunk and
dt.vz.to_icechunk. The default (None) keeps the existing behaviour of
raising ContainsGroupError when the target group already exists, while
mode="a" opens the existing group so datasets can e.g. be split across
commits by variable, and mode="w" overwrites existing contents.
A _resolve_mode helper validates mode and resolves it to the effective
zarr group-open mode ("r+" when append_dim/region require an existing
group), so both writers open groups through a single zarr.open_group
call.
Closes#1001.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/about/releases.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,8 @@
4
4
5
5
### New Features
6
6
- Added [VirtualiZarrDatasetAccessor.nrefs][virtualizarr.accessor.VirtualiZarrDatasetAccessor.nrefs] — a method that returns the total number of virtual chunk references in the dataset, ignoring non-virtual variables. Closes #573.
7
+
-`vds.vz.to_icechunk` and `vdt.vz.to_icechunk` now accept a `mode` parameter controlling how a pre-existing group at the target path is handled: `"w-"` (create, error if the group exists — the previous and still-default behaviour), `"w"` (overwrite existing contents), or `"a"` (open the existing group and add/update variables in it). `mode="a"` enables e.g. splitting a large virtual dataset across commits by variable. Closes #1001.
8
+
By [Aaron Spring](https://github.com/aaronspring).
Copy file name to clipboardExpand all lines: docs/how_to/scaling.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -334,7 +334,7 @@ for i, start in enumerate(range(0, vds.sizes["time"], step)):
334
334
335
335
If the slice boundaries don't align with chunk edges along that axis, the indexing call raises `SubChunkIndexingError`.
336
336
337
-
(Remember you can also subset the Dataset to specific variables and commit those separately too if necessary.)
337
+
(Remember you can also subset the Dataset to specific variables and commit those separately too if necessary — pass `mode="a"` to `to_icechunk` from the second write onwards, so that writing into the already-existing group doesn't raise a `ContainsGroupError`.)
DataTree to write to an Icechunk store. Can contain both "virtual" variables (backed by ManifestArray objects) and "loadable" variables (backed by numpy arrays).
171
208
store
172
209
Store to write the dataset to, which must not be read-only.
210
+
mode
211
+
How to handle pre-existing groups at the target paths:
212
+
213
+
- ``"w-"`` or ``None`` (default): create each group, raising a
214
+
``ContainsGroupError`` if it already exists.
215
+
- ``"w"``: create each group, overwriting any existing contents at that path.
216
+
- ``"a"``: open each group if it exists (keeping existing arrays), otherwise create it.
173
217
write_inherited_coords
174
218
If ``True``, replicate inherited coordinates on all descendant nodes of the
175
219
tree. Otherwise, only write coordinates at the level at which they are
0 commit comments