Skip to content

conjugate not supported on Dask arrays #10302

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

Closed
5 tasks done
joneuhauser opened this issue May 9, 2025 · 6 comments
Closed
5 tasks done

conjugate not supported on Dask arrays #10302

joneuhauser opened this issue May 9, 2025 · 6 comments
Labels
array API standard Support for the Python array API standard bug topic-arrays related to flexible array support topic-dask

Comments

@joneuhauser
Copy link
Contributor

joneuhauser commented May 9, 2025

What happened?

File ".venv/lib/python3.12/site-packages/xarray/core/duck_array_ops.py", line 110, in fail_on_dask_array_input
    raise NotImplementedError(msg % func_name)
NotImplementedError: 'conjugate' is not yet a valid method on dask arrays

What did you expect to happen?

.conjugate() should work on Dask arrays.

Minimal Complete Verifiable Example

import numpy as np
import dask.array as da
import xarray as xr

real = da.random.random((100, 100))
imag = da.random.random((100, 100))
z = real + 1j * imag

data = xr.DataArray(z, coords={'x': np.arange(100), 'y': np.arange(100)})

conj_data = data.conjugate()

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

Anything else we need to know?

No response

Environment

INSTALLED VERSIONS

commit: None
python: 3.12.3 (main, Feb 4 2025, 14:48:35) [GCC 13.3.0]
python-bits: 64
OS: Linux
OS-release: 6.11.0-24-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: de_DE.UTF-8
LOCALE: ('de_DE', 'UTF-8')
libhdf5: 1.14.6
libnetcdf: None

xarray: 2025.3.1
pandas: 2.2.3
numpy: 2.2.5
scipy: 1.15.2
netCDF4: None
pydap: None
h5netcdf: None
h5py: 3.13.0
zarr: 3.0.7
cftime: None
nc_time_axis: None
iris: None
bottleneck: None
dask: 2025.4.0
distributed: 2025.4.0
matplotlib: 3.10.1
cartopy: None
seaborn: None
numbagg: None
fsspec: 2025.3.2
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: None
pip: 24.0
conda: None
pytest: None
mypy: None
IPython: 9.1.0
sphinx: None

@joneuhauser joneuhauser added bug needs triage Issue that has not been reviewed by xarray team member labels May 9, 2025
Copy link

welcome bot commented May 9, 2025

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!

@kmuehlbauer
Copy link
Contributor

Is there any reason you can't use conj-method? I'm not that versed in Python array API, but there only conj is referenced. Numpy has a notion of conjugate and conj, but Dask only has conj.

AFAIK xarray is trying to access both, hence the error when calling conjugate.

@kmuehlbauer kmuehlbauer added array API standard Support for the Python array API standard and removed needs triage Issue that has not been reviewed by xarray team member labels May 9, 2025
@joneuhauser
Copy link
Contributor Author

Would you be interested in a PR forwarding conjugate to conj? It's the same method in numpy anyway, and the change would help towards the "drop-in replacement" of numpy with dask arrays.

@kmuehlbauer
Copy link
Contributor

Would you be interested in a PR forwarding conjugate to conj?

Thanks for that. This part is not my area of expertise. Let's wait for others to chime in, what's the best way forward here.

joneuhauser added a commit to joneuhauser/xarray that referenced this issue May 9, 2025
@joneuhauser
Copy link
Contributor Author

Opened a PR to discuss the change further.

@Illviljan Illviljan added the topic-arrays related to flexible array support label May 9, 2025
kmuehlbauer added a commit that referenced this issue May 23, 2025
Co-authored-by: Jonathan Neuhauser <jonathan.neuhauser@kit.edu>
Co-authored-by: Kai Mühlbauer <kai.muehlbauer@uni-bonn.de>
@kmuehlbauer
Copy link
Contributor

resolved by #10303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
array API standard Support for the Python array API standard bug topic-arrays related to flexible array support topic-dask
Projects
None yet
Development

No branches or pull requests

4 participants