Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ Bug fixes
- Add ``missing_dims`` parameter to transpose (:issue:`4647`, :pull:`4767`). By `Daniel Mesejo <https://github.com/mesejo>`_.
- Resolve intervals before appending other metadata to labels when plotting (:issue:`4322`, :pull:`4794`).
By `Justus Magin <https://github.com/keewis>`_.
- Expand user directory paths (e.g. ``~/``) in :py:func:`open_mfdataset` and
:py:meth:`Dataset.to_zarr` (:issue:`4783`, :pull:`4795`).
By `Julien Seguinot <https://github.com/juseg>`_.

Documentation
~~~~~~~~~~~~~
Expand Down
14 changes: 6 additions & 8 deletions xarray/backends/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ def open_mfdataset(
paths
)
)
paths = sorted(glob(paths))
paths = sorted(glob(_normalize_path(paths)))
else:
paths = [str(p) if isinstance(p, Path) else p for p in paths]

Expand Down Expand Up @@ -1386,10 +1386,11 @@ def to_zarr(

See `Dataset.to_zarr` for full API docs.
"""
if isinstance(store, Path):
store = str(store)
if isinstance(chunk_store, Path):
chunk_store = str(store)

# expand str and Path arguments
store = _normalize_path(store)
chunk_store = _normalize_path(chunk_store)

if encoding is None:
encoding = {}

Expand Down Expand Up @@ -1419,9 +1420,6 @@ def to_zarr(
"compute=False before writing data."
)

if isinstance(store, Path):
store = str(store)

# validate Dataset keys, DataArray names, and attr keys/values
_validate_dataset_names(dataset)
_validate_attrs(dataset)
Expand Down