diff --git a/docs/changelog.rst b/docs/changelog.rst index 7f7a29eb0..7cc66666e 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -83,8 +83,11 @@ Bug fixes matches the computed result, and correlation distances are no longer slightly negative. -.. Documentation -.. ~~~~~~~~~~~~~ +Documentation +~~~~~~~~~~~~~ + +- Explain how the ``mode`` argument controls whether ``save_dataset`` + replaces an existing Zarr store. .. _changelog.0.10.0: diff --git a/sgkit/io/dataset.py b/sgkit/io/dataset.py index 514007202..634ec6308 100644 --- a/sgkit/io/dataset.py +++ b/sgkit/io/dataset.py @@ -19,6 +19,12 @@ def save_dataset( This function is a thin wrapper around :meth:`xarray.Dataset.to_zarr` that uses sensible defaults and makes it easier to use in a pipeline. + By default a save without an append dimension or region refuses to overwrite + an existing store. To replace the entire store, use + ``save_dataset(ds, "ds.zarr", mode="w")``. This removes variables in the store + that are absent from ``ds``. If ``ds`` is lazily loaded from the destination, + finish reading it into memory or choose a different destination before saving. + Parameters ---------- ds