Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -24,6 +24,9 @@ Breaking changes

New Features
~~~~~~~~~~~~
- Support new h5netcdf backend keyword `phony_dims` (available from h5netcdf
v0.8.0 for :py:class:`~xarray.backends.H5NetCDFStore`.
By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_.

Bug fixes
~~~~~~~~~
Expand Down
10 changes: 10 additions & 0 deletions xarray/backends/h5netcdf_.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import functools
from distutils.version import LooseVersion

import numpy as np

Expand Down Expand Up @@ -117,13 +118,22 @@ def open(
lock=None,
autoclose=False,
invalid_netcdf=None,
phony_dims=None,
):
import h5netcdf

if format not in [None, "NETCDF4"]:
raise ValueError("invalid format for h5netcdf backend")

kwargs = {"invalid_netcdf": invalid_netcdf}
if phony_dims is not None:
if LooseVersion(h5netcdf.__version__) >= LooseVersion("0.8.0"):
kwargs["phony_dims"] = phony_dims
else:
raise ValueError(
"h5netcdf backend keyword argument 'phony_dims' needs "
"h5netcdf >= 0.8.0."
)

if lock is None:
if mode == "r":
Expand Down