Skip to content

Commit

Permalink
Adding open_datatree backend-specific keyword arguments (#9199)
Browse files Browse the repository at this point in the history
* adding open_datatree backend keyword arguments for hdf5

* adding open_datatree backend keyword arguments for netCDF4
  • Loading branch information
aladinor authored Jul 23, 2024
1 parent ad35a10 commit d0048ef
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
14 changes: 14 additions & 0 deletions xarray/backends/h5netcdf_.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,14 @@ def open_datatree(
drop_variables: str | Iterable[str] | None = None,
use_cftime=None,
decode_timedelta=None,
format=None,
group: str | Iterable[str] | Callable | None = None,
lock=None,
invalid_netcdf=None,
phony_dims=None,
decode_vlen_strings=True,
driver=None,
driver_kwds=None,
**kwargs,
) -> DataTree:
from xarray.backends.api import open_dataset
Expand All @@ -450,7 +457,14 @@ def open_datatree(
filename_or_obj = _normalize_path(filename_or_obj)
store = H5NetCDFStore.open(
filename_or_obj,
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,
)
if group:
parent = NodePath("/") / NodePath(group)
Expand Down
12 changes: 12 additions & 0 deletions xarray/backends/netCDF4_.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,12 @@ def open_datatree(
use_cftime=None,
decode_timedelta=None,
group: str | Iterable[str] | Callable | None = None,
format="NETCDF4",
clobber=True,
diskless=False,
persist=False,
lock=None,
autoclose=False,
**kwargs,
) -> DataTree:
from xarray.backends.api import open_dataset
Expand All @@ -691,6 +697,12 @@ def open_datatree(
store = NetCDF4DataStore.open(
filename_or_obj,
group=group,
format=format,
clobber=clobber,
diskless=diskless,
persist=persist,
lock=lock,
autoclose=autoclose,
)
if group:
parent = NodePath("/") / NodePath(group)
Expand Down

0 comments on commit d0048ef

Please sign in to comment.