From 730b7aee30f332d0858a79f39c2bf648a71d0819 Mon Sep 17 00:00:00 2001 From: Kai Muehlbauer Date: Wed, 5 Feb 2020 09:37:11 +0100 Subject: [PATCH] ADD: add `phony_dims` keyword arg to h5netcdf backend available from h5netcdf v0.8.0 --- xarray/backends/h5netcdf_.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/xarray/backends/h5netcdf_.py b/xarray/backends/h5netcdf_.py index 2b7c2d9057c..a5a6a31d05a 100644 --- a/xarray/backends/h5netcdf_.py +++ b/xarray/backends/h5netcdf_.py @@ -1,4 +1,5 @@ import functools +from distutils.version import LooseVersion import numpy as np @@ -117,6 +118,7 @@ def open( lock=None, autoclose=False, invalid_netcdf=None, + phony_dims=None, ): import h5netcdf @@ -124,6 +126,14 @@ def open( 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":