diff --git a/doc/whats-new.rst b/doc/whats-new.rst index 28863946bf..89b6573e19 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -153,6 +153,9 @@ Bug fixes - Fix deprecation warning that was raised when calling ``np.array`` on an ``xr.DataArray`` in NumPy 2.0 (:issue:`9312`, :pull:`9393`) By `Andrew Scherer `_. +- Fix passing missing arguments to when opening hdf5 and netCDF4 datatrees + (:issue:`9427`, :pull: `9428`). + By `Alfonso Ladino `_. - Fix support for using ``pandas.DateOffset``, ``pandas.Timedelta``, and ``datetime.timedelta`` objects as ``resample`` frequencies (:issue:`9408`, :pull:`9413`). diff --git a/xarray/backends/h5netcdf_.py b/xarray/backends/h5netcdf_.py index b252d9136d..d7a902faed 100644 --- a/xarray/backends/h5netcdf_.py +++ b/xarray/backends/h5netcdf_.py @@ -453,7 +453,25 @@ def open_datatree( from xarray.core.datatree import DataTree - groups_dict = self.open_groups_as_dict(filename_or_obj, **kwargs) + groups_dict = self.open_groups_as_dict( + filename_or_obj, + mask_and_scale=mask_and_scale, + decode_times=decode_times, + concat_characters=concat_characters, + decode_coords=decode_coords, + drop_variables=drop_variables, + use_cftime=use_cftime, + decode_timedelta=decode_timedelta, + format=format, + group=group, + lock=lock, + invalid_netcdf=invalid_netcdf, + phony_dims=phony_dims, + decode_vlen_strings=decode_vlen_strings, + driver=driver, + driver_kwds=driver_kwds, + **kwargs, + ) return DataTree.from_dict(groups_dict) diff --git a/xarray/backends/netCDF4_.py b/xarray/backends/netCDF4_.py index d1c3719905..be05710de9 100644 --- a/xarray/backends/netCDF4_.py +++ b/xarray/backends/netCDF4_.py @@ -695,7 +695,24 @@ def open_datatree( from xarray.core.datatree import DataTree - groups_dict = self.open_groups_as_dict(filename_or_obj, **kwargs) + groups_dict = self.open_groups_as_dict( + filename_or_obj, + mask_and_scale=mask_and_scale, + decode_times=decode_times, + concat_characters=concat_characters, + decode_coords=decode_coords, + drop_variables=drop_variables, + use_cftime=use_cftime, + decode_timedelta=decode_timedelta, + group=group, + format=format, + clobber=clobber, + diskless=diskless, + persist=persist, + lock=lock, + autoclose=autoclose, + **kwargs, + ) return DataTree.from_dict(groups_dict) diff --git a/xarray/backends/zarr.py b/xarray/backends/zarr.py index c048ea6341..a822bbc02d 100644 --- a/xarray/backends/zarr.py +++ b/xarray/backends/zarr.py @@ -1297,7 +1297,25 @@ def open_datatree( from xarray.core.datatree import DataTree filename_or_obj = _normalize_path(filename_or_obj) - groups_dict = self.open_groups_as_dict(filename_or_obj, **kwargs) + groups_dict = self.open_groups_as_dict( + filename_or_obj=filename_or_obj, + mask_and_scale=mask_and_scale, + decode_times=decode_times, + concat_characters=concat_characters, + decode_coords=decode_coords, + drop_variables=drop_variables, + use_cftime=use_cftime, + decode_timedelta=decode_timedelta, + group=group, + mode=mode, + synchronizer=synchronizer, + consolidated=consolidated, + chunk_store=chunk_store, + storage_options=storage_options, + stacklevel=stacklevel, + zarr_version=zarr_version, + **kwargs, + ) return DataTree.from_dict(groups_dict)