Skip to content

Commit 730b7ae

Browse files
committed
ADD: add phony_dims keyword arg to h5netcdf backend available from h5netcdf v0.8.0
1 parent 4c96d53 commit 730b7ae

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

xarray/backends/h5netcdf_.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import functools
2+
from distutils.version import LooseVersion
23

34
import numpy as np
45

@@ -117,13 +118,22 @@ def open(
117118
lock=None,
118119
autoclose=False,
119120
invalid_netcdf=None,
121+
phony_dims=None,
120122
):
121123
import h5netcdf
122124

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

126128
kwargs = {"invalid_netcdf": invalid_netcdf}
129+
if (phony_dims is not None) & (
130+
LooseVersion(h5netcdf.__version__) >= LooseVersion("0.8.0")
131+
):
132+
kwargs["phony_dims"] = phony_dims
133+
else:
134+
raise (
135+
"h5netcdf backend keyword argument 'phony_dims' needs h5netcdf >= 0.8.0."
136+
)
127137

128138
if lock is None:
129139
if mode == "r":

0 commit comments

Comments
 (0)