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

Improve to_zarr docs #9139

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions xarray/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2458,24 +2458,26 @@ def to_zarr(
If set, the dimension along which the data will be appended. All
other dimensions on overridden variables must remain the same size.
region : dict or "auto", optional
Optional mapping from dimension names to integer slices along
dataset dimensions to indicate the region of existing zarr array(s)
in which to write this dataset's data. For example,
``{'x': slice(0, 1000), 'y': slice(10000, 11000)}`` would indicate
that values should be written to the region ``0:1000`` along ``x``
and ``10000:11000`` along ``y``.

Can also specify ``"auto"``, in which case the existing store will be
opened and the region inferred by matching the new data's coordinates.
``"auto"`` can be used as a single string, which will automatically infer
the region for all dimensions, or as dictionary values for specific
dimensions mixed together with explicit slices for other dimensions.
Optional mapping from dimension names to either a) ``"auto"``, or b) integer
slices, indicating the region of existing zarr array(s) in which to write
this dataset's data.

If ``"auto"`` is provided the existing store will be opened and the region
inferred by matching indexes. ``"auto"`` can be used as a single string,
which will automatically infer the region for all dimensions, or as
dictionary values for specific dimensions mixed together with explicit
slices for other dimensions.

Alternatively integer slices can be provided; for example, ``{'x': slice(0,
1000), 'y': slice(10000, 11000)}`` would indicate that values should be
written to the region ``0:1000`` along ``x`` and ``10000:11000`` along
``y``.

Two restrictions apply to the use of ``region``:

- If ``region`` is set, _all_ variables in a dataset must have at
least one dimension in common with the region. Other variables
should be written in a separate call to ``to_zarr()``.
should be written in a separate single call to ``to_zarr()``.
- Dimensions cannot be included in both ``region`` and
``append_dim`` at the same time. To create empty arrays to fill
in with ``region``, use a separate call to ``to_zarr()`` with
Expand Down
Loading