diff --git a/doc/whats-new.rst b/doc/whats-new.rst index b981ae9427c..0497c4a031f 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -16,6 +16,8 @@ New Features - :py:func:`merge` and :py:func:`concat` now support :py:class:`DataTree` objects (:issue:`9790`, :issue:`9778`). By `Stephan Hoyer `_. +- The ``h5netcdf`` engine has support for pseudo ``NETCDF4_CLASSIC`` files, meaning variables and attributes are cast to supported types. Note that the saved files won't be recognized as genuine ``NETCDF4_CLASSIC`` files until ``h5netcdf`` adds support with version 1.7.0. (:issue:`10676`, :pull:`10686`). + By `David Huard `_. Breaking Changes ~~~~~~~~~~~~~~~~ @@ -27,6 +29,8 @@ Deprecations Bug Fixes ~~~~~~~~~ +- Fix h5netcdf backend for format=None, use same rule as netcdf4 backend (:pull:`10859`). + By `Kai Mühlbauer `_ Documentation @@ -285,8 +289,6 @@ New Features - ``compute=False`` is now supported by :py:meth:`DataTree.to_netcdf` and :py:meth:`DataTree.to_zarr`. By `Stephan Hoyer `_. -- The ``h5netcdf`` engine has support for pseudo ``NETCDF4_CLASSIC`` files, meaning variables and attributes are cast to supported types. Note that the saved files won't be recognized as genuine ``NETCDF4_CLASSIC`` files until ``h5netcdf`` adds support. (:issue:`10676`, :pull:`10686`). - By `David Huard `_. - ``open_dataset`` will now correctly infer a path ending in ``.zarr/`` as zarr By `Ian Hunt-Isaak `_. diff --git a/xarray/backends/h5netcdf_.py b/xarray/backends/h5netcdf_.py index 78719960f63..8967ae97802 100644 --- a/xarray/backends/h5netcdf_.py +++ b/xarray/backends/h5netcdf_.py @@ -204,7 +204,10 @@ def open( f"{magic_number!r} is not the signature of a valid netCDF4 file" ) - if format not in [None, "NETCDF4", "NETCDF4_CLASSIC"]: + if format is None: + format = "NETCDF4" + + if format not in ["NETCDF4", "NETCDF4_CLASSIC"]: raise ValueError(f"invalid format for h5netcdf backend: {format}") kwargs = {