Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

open_datatree not accepting backend-specific keyword arguments #9135

Closed
5 tasks done
kmnhan opened this issue Jun 19, 2024 · 2 comments
Closed
5 tasks done

open_datatree not accepting backend-specific keyword arguments #9135

kmnhan opened this issue Jun 19, 2024 · 2 comments
Labels
bug topic-DataTree Related to the implementation of a DataTree class

Comments

@kmnhan
Copy link

kmnhan commented Jun 19, 2024

What happened?

Following #9014, open_datatree no longer passes on backend-specific keyword arguments. For instance, I have a few HDF5 datasets with unassociated dimension scales, and those require phony_dims='sort' or phony_dims='access' to be opened. Now, the keyword arguments are passed onto StoreBackendEntrypoint.open_dataset instead of H5netcdfBackendEntrypoint.open_dataset which results in a TypeError.

What did you expect to happen?

open_datatree methods of backends should pass backend-specific keyword arguments to H5NetCDFStore.open or the like.

Minimal Complete Verifiable Example

import h5py
from xarray.backends.api import open_datatree

file = h5py.File("./test.h5", "w")
data = file.create_dataset("dataset", shape=(10, 20, 30), dtype="float32")
file.close()

try:
    open_datatree("./test.h5")  # this is normal
except ValueError as e:
    print(e, "\n")
# variable '/dataset' has no dimension scale associated with axis 0.
# Use phony_dims='sort' for sorted naming or phony_dims='access' for per access naming.

try:
    open_datatree("./test.h5", phony_dims="sort")  # used to work, now raises TypeError
except TypeError as e:
    print(e)
# StoreBackendEntrypoint.open_dataset() got an unexpected keyword argument 'phony_dims'

MVCE confirmation

  • Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • Complete example — the example is self-contained, including all data and the text of any traceback.
  • Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • New issue — a search of GitHub Issues suggests this is not a duplicate.
  • Recent environment — the issue occurs with the latest version of xarray and its dependencies.

Relevant log output

No response

Anything else we need to know?

No response

Environment

INSTALLED VERSIONS

commit: None
python: 3.12.4 | packaged by conda-forge | (main, Jun 17 2024, 10:13:44) [Clang 16.0.6 ]
python-bits: 64
OS: Darwin
OS-release: 23.5.0
machine: arm64
processor: arm
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.14.3
libnetcdf: None

xarray: 2024.6.0
pandas: 2.2.2
numpy: 2.0.0
scipy: None
netCDF4: None
pydap: None
h5netcdf: 1.3.0
h5py: 3.11.0
zarr: None
cftime: None
nc_time_axis: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: None
cartopy: None
seaborn: None
numbagg: None
fsspec: None
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 70.0.0
pip: 24.0
conda: None
pytest: None
mypy: None
IPython: None
sphinx: None
None

@kmnhan kmnhan added bug needs triage Issue that has not been reviewed by xarray team member labels Jun 19, 2024
Copy link

welcome bot commented Jun 19, 2024

Thanks for opening your first issue here at xarray! Be sure to follow the issue template!
If you have an idea for a solution, we would really welcome a Pull Request with proposed changes.
See the Contributing Guide for more.
It may take us a while to respond here, but we really value your contribution. Contributors like you help make xarray better.
Thank you!

@TomNicholas TomNicholas added topic-DataTree Related to the implementation of a DataTree class and removed needs triage Issue that has not been reviewed by xarray team member labels Jun 19, 2024
@flamingbear
Copy link
Member

I believed this was closed by #9199, or should have been.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug topic-DataTree Related to the implementation of a DataTree class
Projects
None yet
Development

No branches or pull requests

3 participants