issues: 1186949971
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1186949971 | I_kwDOAMm_X85Gv2tT | 6427 | Inverting Datasets or DataArrays with dask float data throws wrong ValueError instead of TypeError | 7178572 | open | 0 | 5 | 2022-03-30T20:26:02Z | 2022-03-31T23:42:30Z | NONE | What happened?Inverting (__invert__) a DataArray or Dataset containing dask float data throws a What did you expect to happen?I expected a TypeError with a relevant message about the type (shown below), not a ValueError with a misleading message. ```python import xarray as xr import dask.array as da data = da.from_array([1.0]) x = xr.DataArray(data) ~x Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/USEr/anaconda3/envs/rstools/lib/python3.8/site-packages/xarray/core/_typed_ops.py", line 329, in invert return self._unary_op(operator.invert) File "/home/USER/anaconda3/envs/rstools/lib/python3.8/site-packages/xarray/core/dataarray.py", line 3078, in _unary_op da = self.array_wrap(f(self.variable.data, args, *kwargs)) TypeError: ufunc 'invert' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'' ``` Minimal Complete Verifiable Example```Python import xarray as xr import dask.array as da data = da.from_array([1.0]) x = xr.DataArray(data) ~x ``` Relevant log output
Anything else we need to know?No response Environment/home/USER/anaconda3/envs/rstools/lib/python3.8/site-packages/_distutils_hack/init.py:30: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.") INSTALLED VERSIONScommit: None python: 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:04:10) [GCC 10.3.0] python-bits: 64 OS: Linux OS-release: 5.13.0-35-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: None libnetcdf: None xarray: 2022.3.0 pandas: 1.4.1 numpy: 1.21.5 scipy: 1.8.0 netCDF4: None pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: 1.2.10 cfgrib: None iris: None bottleneck: None dask: 2022.03.0 distributed: 2022.3.0 matplotlib: 3.5.1 cartopy: None seaborn: None numbagg: None fsspec: 2022.02.0 cupy: None pint: None sparse: None setuptools: 61.2.0 pip: 22.0.4 conda: None pytest: 7.1.1 IPython: 8.2.0 sphinx: None |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/6427/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | issue |