Skip to content

Commit

Permalink
ADD: add phony_dims keyword arg to h5netcdf backend available from …
Browse files Browse the repository at this point in the history
…h5netcdf v0.8.0
  • Loading branch information
kmuehlbauer committed Feb 6, 2020
1 parent 4c96d53 commit 730b7ae
Showing 1 changed file with 10 additions and 0 deletions.
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) & (
LooseVersion(h5netcdf.__version__) >= LooseVersion("0.8.0")
):
kwargs["phony_dims"] = phony_dims
else:
raise (
"h5netcdf backend keyword argument 'phony_dims' needs h5netcdf >= 0.8.0."
)

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

0 comments on commit 730b7ae

Please sign in to comment.