Skip to content

Commit af722f0

Browse files
authored
Improve to_zarr docs (#9139)
Promoted `region='auto'`, refine the langague slightly
1 parent 3fd162e commit af722f0

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

xarray/core/dataset.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2458,24 +2458,26 @@ def to_zarr(
24582458
If set, the dimension along which the data will be appended. All
24592459
other dimensions on overridden variables must remain the same size.
24602460
region : dict or "auto", optional
2461-
Optional mapping from dimension names to integer slices along
2462-
dataset dimensions to indicate the region of existing zarr array(s)
2463-
in which to write this dataset's data. For example,
2464-
``{'x': slice(0, 1000), 'y': slice(10000, 11000)}`` would indicate
2465-
that values should be written to the region ``0:1000`` along ``x``
2466-
and ``10000:11000`` along ``y``.
2467-
2468-
Can also specify ``"auto"``, in which case the existing store will be
2469-
opened and the region inferred by matching the new data's coordinates.
2470-
``"auto"`` can be used as a single string, which will automatically infer
2471-
the region for all dimensions, or as dictionary values for specific
2472-
dimensions mixed together with explicit slices for other dimensions.
2461+
Optional mapping from dimension names to either a) ``"auto"``, or b) integer
2462+
slices, indicating the region of existing zarr array(s) in which to write
2463+
this dataset's data.
2464+
2465+
If ``"auto"`` is provided the existing store will be opened and the region
2466+
inferred by matching indexes. ``"auto"`` can be used as a single string,
2467+
which will automatically infer the region for all dimensions, or as
2468+
dictionary values for specific dimensions mixed together with explicit
2469+
slices for other dimensions.
2470+
2471+
Alternatively integer slices can be provided; for example, ``{'x': slice(0,
2472+
1000), 'y': slice(10000, 11000)}`` would indicate that values should be
2473+
written to the region ``0:1000`` along ``x`` and ``10000:11000`` along
2474+
``y``.
24732475
24742476
Two restrictions apply to the use of ``region``:
24752477
24762478
- If ``region`` is set, _all_ variables in a dataset must have at
24772479
least one dimension in common with the region. Other variables
2478-
should be written in a separate call to ``to_zarr()``.
2480+
should be written in a separate single call to ``to_zarr()``.
24792481
- Dimensions cannot be included in both ``region`` and
24802482
``append_dim`` at the same time. To create empty arrays to fill
24812483
in with ``region``, use a separate call to ``to_zarr()`` with

0 commit comments

Comments
 (0)