Add support for Array API in NamedArray #13907
144 errors, 4 407 fail, 1 618 skipped, 13 776 pass in 1h 33m 35s
Annotations
github-actions / Test Results
8 out of 10 runs with error: xarray.tests.test_dask
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
collection failure
collection failure
collection failure
collection failure
#x1B[1m#x1B[31mxarray/tests/test_dask.py#x1B[0m:1127: in <module>
@pytest.mark.parametrize("obj", [make_ds(), make_da()])
#x1B[1m#x1B[31mxarray/tests/test_dask.py#x1B[0m:1067: in make_ds
map_ds["a"] = make_da()
#x1B[1m#x1B[31mxarray/tests/test_dask.py#x1B[0m:1060: in make_da
da.coords["cxy"] = (da.x * da.y).chunk({"x": 4, "y": 5})
#x1B[1m#x1B[31mxarray/core/_typed_ops.py#x1B[0m:253: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mxarray/core/dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mxarray/namedarray/core.py#x1B[0m:545: in __mul__
return multiply(self, asarray(other))
#x1B[1m#x1B[31mxarray/namedarray/_array_api/_elementwise_functions.py#x1B[0m:355: in multiply
out = x1._new(data=xp.multiply(x1._data, x2._data))
#x1B[1m#x1B[31mE ValueError: operands could not be broadcast together with shapes (10,) (20,)#x1B[0m
#x1B[1m#x1B[31mxarray/tests/test_dask.py#x1B[0m:1127: in <module>
@pytest.mark.parametrize("obj", [make_ds(), make_da()])
#x1B[1m#x1B[31mxarray/tests/test_dask.py#x1B[0m:1067: in make_ds
map_ds["a"] = make_da()
#x1B[1m#x1B[31mxarray/tests/test_dask.py#x1B[0m:1060: in make_da
da.coords["cxy"] = (da.x * da.y).chunk({"x": 4, "y": 5})
#x1B[1m#x1B[31mxarray/core/_typed_ops.py#x1B[0m:253: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mxarray/core/dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mxarray/namedarray/core.py#x1B[0m:545: in __mul__
return multiply(self, asarray(other))
#x1B[1m#x1B[31mxarray/namedarray/_array_api/_elementwise_functions.py#x1B[0m:355: in multiply
out = x1._new(data=xp.multiply(x1._data, x2._data))
#x1B[1m#x1B[31mE ValueError: operands could not be broadcast together with shapes (10,) (20,)#x1B[0m
#x1B[1m#x1B[31mxarray/tests/test_dask.py#x1B[0m:1127: in <module>
@pytest.mark.parametrize("obj", [make_ds(), make_da()])
#x1B[1m#x1B[31mxarray/tests/test_dask.py#x1B[0m:1067: in make_ds
map_ds["a"] = make_da()
#x1B[1m#x1B[31mxarray/tests/test_dask.py#x1B[0m:1060: in make_da
da.coords["cxy"] = (da.x * da.y).chunk({"x": 4, "y": 5})
#x1B[1m#x1B[31mxarray/core/_typed_ops.py#x1B[0m:253: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mxarray/core/dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mxarray/namedarray/core.py#x1B[0m:545: in __mul__
return multiply(self, asarray(other))
#x1B[1m#x1B[31mxarray/namedarray/_array_api/_elementwise_functions.py#x1B[0m:355: in multiply
out = x1._new(data=xp.multiply(x1._data, x2._data))
#x1B[1m#x1B[31mE ValueError: operands could not be broadcast together with shapes (10,) (20,)#x1B[0m
#x1B[1m#x1B[31mxarray/tests/test_dask.py#x1B[0m:1127: in <module>
@pytest.mark.parametrize("obj", [make_ds(), make_da()])
#x1B[1m#x1B[31mxarray/tests/test_dask.py#x1B[0m:1067: in make_ds
map_ds["a"] = make_da()
#x1B[1m#x1B[31mxarray/tests/test_dask.py#x1B[0m:1060: in make_da
da.coords["cxy"] = (da.x * da.y).chunk({"x": 4, "y": 5})
#x1B[1m#x1B[31mxarray/core/_typed_ops.py#x1B[0m:253: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mxarray/core/dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mxarray/namedarray/core.py#x1B[0m:545: in __mul__
return multiply(self, asarray(other))
#x1B[1m#x1B[31mxarray/namedarray/_array_api/_elementwise_functions.py#x1B[0m:355: in multiply
out = x1._new(data=xp.multiply(x1._data, x2._data))
#x1B[1m#x1B[31mE ValueError: operands could not be broadcast together with shapes (10,) (20,)#x1B[0m
github-actions / Test Results
3 out of 4 runs with error: xarray.tests.test_sparse
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
collection failure
collection failure
collection failure
collection failure
#x1B[1m#x1B[31mxarray\tests\test_sparse.py#x1B[0m:220: in <module>
(do("where", cond=make_xrvar({"x": 10, "y": 5}) > 0.5), True),
#x1B[1m#x1B[31mxarray\namedarray\core.py#x1B[0m:496: in __gt__
from xarray.namedarray._array_api import asarray, greater
#x1B[1m#x1B[31mxarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mxarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: in __getattr__
warnings.warn(
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mxarray\tests\test_sparse.py#x1B[0m:220: in <module>
(do("where", cond=make_xrvar({"x": 10, "y": 5}) > 0.5), True),
#x1B[1m#x1B[31mxarray\namedarray\core.py#x1B[0m:496: in __gt__
from xarray.namedarray._array_api import asarray, greater
#x1B[1m#x1B[31mxarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mxarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: in __getattr__
warnings.warn(
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mxarray\tests\test_sparse.py#x1B[0m:220: in <module>
(do("where", cond=make_xrvar({"x": 10, "y": 5}) > 0.5), True),
#x1B[1m#x1B[31mxarray\namedarray\core.py#x1B[0m:496: in __gt__
from xarray.namedarray._array_api import asarray, greater
#x1B[1m#x1B[31mxarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mxarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: in __getattr__
warnings.warn(
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mxarray\tests\test_sparse.py#x1B[0m:220: in <module>
(do("where", cond=make_xrvar({"x": 10, "y": 5}) > 0.5), True),
#x1B[1m#x1B[31mxarray\namedarray\core.py#x1B[0m:496: in __gt__
from xarray.namedarray._array_api import asarray, greater
#x1B[1m#x1B[31mxarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mxarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: in __getattr__
warnings.warn(
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
Check warning on line 0 in xarray.tests.test_backends.TestZarrDirectoryStore
github-actions / Test Results
1 out of 9 runs failed: test_write_read_select_write (xarray.tests.test_backends.TestZarrDirectoryStore)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
TypeError: asarray() got an unexpected keyword argument 'device'
self = <xarray.tests.test_backends.TestZarrDirectoryStore object at 0x7f24db2edfc0>
def test_write_read_select_write(self) -> None:
# Test for https://github.com/pydata/xarray/issues/4084
ds = create_test_data()
# NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug.
with self.create_zarr_target() as initial_store:
ds.to_zarr(initial_store, mode="w", **self.version_kwargs)
ds1 = xr.open_zarr(initial_store, **self.version_kwargs)
# Combination of where+squeeze triggers error on write.
> ds_sel = ds1.where(ds1.coords["dim3"] == "a", drop=True).squeeze("dim3")
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:3070:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/_typed_ops.py#x1B[0m:295: in __eq__
return self._binary_op(other, nputils.array_eq)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/nputils.py#x1B[0m:113: in array_eq
return _ensure_bool_is_ndarray(self == other, self, other)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:469: in __eq__
return equal(self, asarray(other))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = 'a'
def asarray(
obj: duckarray[_ShapeType, _DType] | _ArrayLike,
/,
*,
dtype: _DType | None = None,
device: _Device | None = None,
copy: bool | None = None,
dims: _DimsLike = _default,
) -> NamedArray[_ShapeType, _DType] | NamedArray[Any, Any]:
"""
Create a Named array from an array-like object.
Parameters
----------
dims : str or iterable of str
Name(s) of the dimension(s).
data : T_DuckArray or ArrayLike
The actual data that populates the array. Should match the
shape specified by `dims`.
attrs : dict, optional
A dictionary containing any additional information or
attributes you want to store with the array.
Default is None, meaning no attributes will be stored.
"""
data = obj
if isinstance(data, NamedArray):
if copy:
return data.copy()
else:
return data
# TODO: dask.array.ma.MaskedArray also exists, better way?
if isinstance(data, np.ma.MaskedArray):
mask = np.ma.getmaskarray(data) # type: ignore[no-untyped-call]
if mask.any():
# TODO: requires refactoring/vendoring xarray.core.dtypes and
# xarray.core.duck_array_ops
raise NotImplementedError("MaskedArray is not supported yet")
_dims = _infer_dims(data.shape, dims)
return NamedArray(_dims, data)
if isinstance(data, _arrayfunction_or_api):
_dims = _infer_dims(data.shape, dims)
return NamedArray(_dims, data)
if isinstance(data, tuple):
_data = to_0d_object_array(data)
_dims = _infer_dims(_data.shape, dims)
return NamedArray(_dims, _data)
# validate whether the data is valid data types.
> _data = np.asarray(data, dtype=dtype, device=device, copy=copy)
#x1B[1m#x1B[31mE TypeError: asarray() got an unexpected keyword argument 'device'#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_creation_functions.py#x1B[0m:144: TypeError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
1 out of 9 runs failed: test_isel_dataarray (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
TypeError: asarray() got an unexpected keyword argument 'device'
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f24d98f55a0>
def test_isel_dataarray(self) -> None:
# Make sure isel works lazily. GH:issue:1688
in_memory = create_test_data()
with self.roundtrip(in_memory) as on_disk:
> expected = in_memory.isel(dim2=in_memory["dim2"] < 3)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:800:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/_typed_ops.py#x1B[0m:283: in __lt__
return self._binary_op(other, operator.lt)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:530: in __lt__
return less(self, asarray(other))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = 3
def asarray(
obj: duckarray[_ShapeType, _DType] | _ArrayLike,
/,
*,
dtype: _DType | None = None,
device: _Device | None = None,
copy: bool | None = None,
dims: _DimsLike = _default,
) -> NamedArray[_ShapeType, _DType] | NamedArray[Any, Any]:
"""
Create a Named array from an array-like object.
Parameters
----------
dims : str or iterable of str
Name(s) of the dimension(s).
data : T_DuckArray or ArrayLike
The actual data that populates the array. Should match the
shape specified by `dims`.
attrs : dict, optional
A dictionary containing any additional information or
attributes you want to store with the array.
Default is None, meaning no attributes will be stored.
"""
data = obj
if isinstance(data, NamedArray):
if copy:
return data.copy()
else:
return data
# TODO: dask.array.ma.MaskedArray also exists, better way?
if isinstance(data, np.ma.MaskedArray):
mask = np.ma.getmaskarray(data) # type: ignore[no-untyped-call]
if mask.any():
# TODO: requires refactoring/vendoring xarray.core.dtypes and
# xarray.core.duck_array_ops
raise NotImplementedError("MaskedArray is not supported yet")
_dims = _infer_dims(data.shape, dims)
return NamedArray(_dims, data)
if isinstance(data, _arrayfunction_or_api):
_dims = _infer_dims(data.shape, dims)
return NamedArray(_dims, data)
if isinstance(data, tuple):
_data = to_0d_object_array(data)
_dims = _infer_dims(_data.shape, dims)
return NamedArray(_dims, _data)
# validate whether the data is valid data types.
> _data = np.asarray(data, dtype=dtype, device=device, copy=copy)
#x1B[1m#x1B[31mE TypeError: asarray() got an unexpected keyword argument 'device'#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_creation_functions.py#x1B[0m:144: TypeError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
1 out of 9 runs failed: test_append_overwrite_values (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
TypeError: asarray() got an unexpected keyword argument 'device'
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f24d98f6a40>
def test_append_overwrite_values(self) -> None:
# regression for GH1215
data = create_test_data()
with create_tmp_file(allow_cleanup_failure=False) as tmp_file:
self.save(data, tmp_file, mode="w")
data["var2"][:] = -999
> data["var9"] = data["var2"] * 3
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:1346:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/_typed_ops.py#x1B[0m:253: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:545: in __mul__
return multiply(self, asarray(other))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = 3
def asarray(
obj: duckarray[_ShapeType, _DType] | _ArrayLike,
/,
*,
dtype: _DType | None = None,
device: _Device | None = None,
copy: bool | None = None,
dims: _DimsLike = _default,
) -> NamedArray[_ShapeType, _DType] | NamedArray[Any, Any]:
"""
Create a Named array from an array-like object.
Parameters
----------
dims : str or iterable of str
Name(s) of the dimension(s).
data : T_DuckArray or ArrayLike
The actual data that populates the array. Should match the
shape specified by `dims`.
attrs : dict, optional
A dictionary containing any additional information or
attributes you want to store with the array.
Default is None, meaning no attributes will be stored.
"""
data = obj
if isinstance(data, NamedArray):
if copy:
return data.copy()
else:
return data
# TODO: dask.array.ma.MaskedArray also exists, better way?
if isinstance(data, np.ma.MaskedArray):
mask = np.ma.getmaskarray(data) # type: ignore[no-untyped-call]
if mask.any():
# TODO: requires refactoring/vendoring xarray.core.dtypes and
# xarray.core.duck_array_ops
raise NotImplementedError("MaskedArray is not supported yet")
_dims = _infer_dims(data.shape, dims)
return NamedArray(_dims, data)
if isinstance(data, _arrayfunction_or_api):
_dims = _infer_dims(data.shape, dims)
return NamedArray(_dims, data)
if isinstance(data, tuple):
_data = to_0d_object_array(data)
_dims = _infer_dims(_data.shape, dims)
return NamedArray(_dims, _data)
# validate whether the data is valid data types.
> _data = np.asarray(data, dtype=dtype, device=device, copy=copy)
#x1B[1m#x1B[31mE TypeError: asarray() got an unexpected keyword argument 'device'#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_creation_functions.py#x1B[0m:144: TypeError
Check warning on line 0 in xarray.tests.test_accessor_dt.TestDatetimeAccessor
github-actions / Test Results
4 out of 9 runs failed: test_total_seconds (xarray.tests.test_accessor_dt.TestDatetimeAccessor)
artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_accessor_dt.TestDatetimeAccessor object at 0x00000187DEBD8E60>
def test_total_seconds(self) -> None:
# Subtract a value in the middle of the range to ensure that some values
# are negative
> delta = self.data.time - np.datetime64("2000-01-03")
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_accessor_dt.py#x1B[0m:107:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:250: in __sub__
return self._binary_op(other, operator.sub)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:590: in __sub__
from xarray.namedarray._array_api import asarray, subtract
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
1 out of 9 runs failed: test_write_read_select_write (xarray.tests.test_backends.TestZarrWriteEmpty)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
Raw output
TypeError: asarray() got an unexpected keyword argument 'device'
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7fbe3eaf5ba0>
def test_write_read_select_write(self) -> None:
# Test for https://github.com/pydata/xarray/issues/4084
ds = create_test_data()
# NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug.
with self.create_zarr_target() as initial_store:
ds.to_zarr(initial_store, mode="w", **self.version_kwargs)
ds1 = xr.open_zarr(initial_store, **self.version_kwargs)
# Combination of where+squeeze triggers error on write.
> ds_sel = ds1.where(ds1.coords["dim3"] == "a", drop=True).squeeze("dim3")
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:3070:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/_typed_ops.py#x1B[0m:295: in __eq__
return self._binary_op(other, nputils.array_eq)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/nputils.py#x1B[0m:113: in array_eq
return _ensure_bool_is_ndarray(self == other, self, other)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:469: in __eq__
return equal(self, asarray(other))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
obj = 'a'
def asarray(
obj: duckarray[_ShapeType, _DType] | _ArrayLike,
/,
*,
dtype: _DType | None = None,
device: _Device | None = None,
copy: bool | None = None,
dims: _DimsLike = _default,
) -> NamedArray[_ShapeType, _DType] | NamedArray[Any, Any]:
"""
Create a Named array from an array-like object.
Parameters
----------
dims : str or iterable of str
Name(s) of the dimension(s).
data : T_DuckArray or ArrayLike
The actual data that populates the array. Should match the
shape specified by `dims`.
attrs : dict, optional
A dictionary containing any additional information or
attributes you want to store with the array.
Default is None, meaning no attributes will be stored.
"""
data = obj
if isinstance(data, NamedArray):
if copy:
return data.copy()
else:
return data
# TODO: dask.array.ma.MaskedArray also exists, better way?
if isinstance(data, np.ma.MaskedArray):
mask = np.ma.getmaskarray(data) # type: ignore[no-untyped-call]
if mask.any():
# TODO: requires refactoring/vendoring xarray.core.dtypes and
# xarray.core.duck_array_ops
raise NotImplementedError("MaskedArray is not supported yet")
_dims = _infer_dims(data.shape, dims)
return NamedArray(_dims, data)
if isinstance(data, _arrayfunction_or_api):
_dims = _infer_dims(data.shape, dims)
return NamedArray(_dims, data)
if isinstance(data, tuple):
_data = to_0d_object_array(data)
_dims = _infer_dims(_data.shape, dims)
return NamedArray(_dims, _data)
# validate whether the data is valid data types.
> _data = np.asarray(data, dtype=dtype, device=device, copy=copy)
#x1B[1m#x1B[31mE TypeError: asarray() got an unexpected keyword argument 'device'#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/_array_api/_creation_functions.py#x1B[0m:144: TypeError
Check warning on line 0 in xarray.tests.test_accessor_dt.TestDatetimeAccessor
github-actions / Test Results
4 out of 9 runs failed: test_strftime (xarray.tests.test_accessor_dt.TestDatetimeAccessor)
artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_accessor_dt.TestDatetimeAccessor object at 0x00000187DEBDB380>
def test_strftime(self) -> None:
> assert (
"2000-01-01 01:00:00" == self.data.time.dt.strftime("%Y-%m-%d %H:%M:%S")[1]
)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_accessor_dt.py#x1B[0m:140:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:295: in __eq__
return self._binary_op(other, nputils.array_eq)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\nputils.py#x1B[0m:113: in array_eq
return _ensure_bool_is_ndarray(self == other, self, other)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:467: in __eq__
from xarray.namedarray._array_api import asarray, equal
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_backends.TestZarrKVStoreV3
github-actions / Test Results
3 out of 9 runs failed: test_isel_dataarray (xarray.tests.test_backends.TestZarrKVStoreV3)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_backends.TestZarrKVStoreV3 object at 0x000001FE11C9C8C0>
def test_isel_dataarray(self) -> None:
# Make sure isel works lazily. GH:issue:1688
in_memory = create_test_data()
with self.roundtrip(in_memory) as on_disk:
> expected = in_memory.isel(dim2=in_memory["dim2"] < 3)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:800:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:283: in __lt__
return self._binary_op(other, operator.lt)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:528: in __lt__
from xarray.namedarray._array_api import asarray, less
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_backends.TestH5NetCDFData
github-actions / Test Results
3 out of 9 runs failed: test_isel_dataarray (xarray.tests.test_backends.TestH5NetCDFData)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_backends.TestH5NetCDFData object at 0x000001254F141D60>
def test_isel_dataarray(self) -> None:
# Make sure isel works lazily. GH:issue:1688
in_memory = create_test_data()
with self.roundtrip(in_memory) as on_disk:
> expected = in_memory.isel(dim2=in_memory["dim2"] < 3)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:800:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:283: in __lt__
return self._binary_op(other, operator.lt)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:528: in __lt__
from xarray.namedarray._array_api import asarray, less
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_backends.TestZarrKVStoreV3
github-actions / Test Results
3 out of 9 runs failed: test_append_overwrite_values (xarray.tests.test_backends.TestZarrKVStoreV3)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_backends.TestZarrKVStoreV3 object at 0x000001FE11CD4F50>
def test_append_overwrite_values(self) -> None:
# regression for GH1215
data = create_test_data()
with create_tmp_file(allow_cleanup_failure=False) as tmp_file:
self.save(data, tmp_file, mode="w")
data["var2"][:] = -999
> data["var9"] = data["var2"] * 3
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:1346:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:253: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:543: in __mul__
from xarray.namedarray._array_api import asarray, multiply
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_backends.TestH5NetCDFData
github-actions / Test Results
3 out of 9 runs failed: test_append_overwrite_values (xarray.tests.test_backends.TestH5NetCDFData)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_backends.TestH5NetCDFData object at 0x000001254F122750>
def test_append_overwrite_values(self) -> None:
# regression for GH1215
data = create_test_data()
with create_tmp_file(allow_cleanup_failure=False) as tmp_file:
self.save(data, tmp_file, mode="w")
data["var2"][:] = -999
> data["var9"] = data["var2"] * 3
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:1346:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:253: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:543: in __mul__
from xarray.namedarray._array_api import asarray, multiply
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_backends.TestH5NetCDFData
github-actions / Test Results
3 out of 9 runs failed: test_append_with_invalid_dim_raises (xarray.tests.test_backends.TestH5NetCDFData)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_backends.TestH5NetCDFData object at 0x000001254F1229C0>
def test_append_with_invalid_dim_raises(self) -> None:
data = create_test_data()
with create_tmp_file(allow_cleanup_failure=False) as tmp_file:
self.save(data, tmp_file, mode="w")
> data["var9"] = data["var2"] * 3
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:1355:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:253: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:543: in __mul__
from xarray.namedarray._array_api import asarray, multiply
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_array_api
github-actions / Test Results
All 8 runs failed: test_arithmetic (xarray.tests.test_array_api)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
arrays = (<xarray.DataArray (x: 2, y: 3)> Size: 48B
array([[ 1., 2., 3.],
[ 4., 5., nan]])
Coordinates:
* x ... nan]], dtype=array_api_strict.float64)
Coordinates:
* x (x) int32 8B 10 20
Dimensions without coordinates: y)
def test_arithmetic(arrays: tuple[xr.DataArray, xr.DataArray]) -> None:
np_arr, xp_arr = arrays
> expected = np_arr + 7
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_array_api.py#x1B[0m:32:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:247: in __add__
return self._binary_op(other, operator.add)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:424: in __add__
from xarray.namedarray._array_api import add, asarray
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_array_api
github-actions / Test Results
All 8 runs failed: test_broadcast_during_arithmetic (xarray.tests.test_array_api)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
arrays = (<xarray.DataArray (x: 2, y: 3)> Size: 48B
array([[ 1., 2., 3.],
[ 4., 5., nan]])
Coordinates:
* x ... nan]], dtype=array_api_strict.float64)
Coordinates:
* x (x) int32 8B 10 20
Dimensions without coordinates: y)
def test_broadcast_during_arithmetic(arrays: tuple[xr.DataArray, xr.DataArray]) -> None:
np_arr, xp_arr = arrays
np_arr2 = xr.DataArray(np.array([1.0, 2.0]), dims="x")
xp_arr2 = xr.DataArray(xp.asarray([1.0, 2.0]), dims="x")
> expected = np_arr * np_arr2
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_array_api.py#x1B[0m:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:253: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:543: in __mul__
from xarray.namedarray._array_api import asarray, multiply
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_backends.TestH5NetCDFData
github-actions / Test Results
3 out of 9 runs failed: test_write_groups (xarray.tests.test_backends.TestH5NetCDFData)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_backends.TestH5NetCDFData object at 0x000001254F0E7E90>
def test_write_groups(self) -> None:
data1 = create_test_data()
> data2 = data1 * 2
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:1493:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:41: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataset.py#x1B[0m:7778: in _binary_op
ds = self._calculate_binary_op(g, other, join=align_type)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataset.py#x1B[0m:7847: in _calculate_binary_op
new_vars = {k: f(self.variables[k], other_variable) for k in self.data_vars}
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:543: in __mul__
from xarray.namedarray._array_api import asarray, multiply
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_assertions
github-actions / Test Results
4 out of 9 runs failed: test_ensure_warnings_not_elevated[assert_duckarray_equal] (xarray.tests.test_assertions)
artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?
func = 'assert_duckarray_equal'
@pytest.mark.parametrize(
"func",
[
"assert_equal",
"assert_identical",
"assert_allclose",
"assert_duckarray_equal",
"assert_duckarray_allclose",
],
)
def test_ensure_warnings_not_elevated(func) -> None:
# make sure warnings are not elevated to errors in the assertion functions
# e.g. by @pytest.mark.filterwarnings("error")
# see https://github.com/pydata/xarray/pull/4760#issuecomment-774101639
# define a custom Variable class that raises a warning in assert_*
class WarningVariable(xr.Variable):
@property # type: ignore[misc]
def dims(self):
warnings.warn("warning in test")
return super().dims
def __array__(self, dtype=None, copy=None):
warnings.warn("warning in test")
return super().__array__()
a = WarningVariable("x", [1])
b = WarningVariable("x", [2])
with warnings.catch_warnings(record=True) as w:
# elevate warnings to errors
warnings.filterwarnings("error")
with pytest.raises(AssertionError):
> getattr(xr.testing, func)(a, b)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_assertions.py#x1B[0m:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\duck_array_ops.py#x1B[0m:314: in array_equiv
flag_array = (arr1 == arr2) | (isnull(arr1) & isnull(arr2))
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:467: in __eq__
from xarray.namedarray._array_api import asarray, equal
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
if attr in __former_attrs__:
> raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:324: AttributeError
Check warning on line 0 in xarray.tests.test_assertions
github-actions / Test Results
4 out of 9 runs failed: test_ensure_warnings_not_elevated[assert_duckarray_allclose] (xarray.tests.test_assertions)
artifacts/Test results for Linux-3.10 bare-minimum/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?
func = 'assert_duckarray_allclose'
@pytest.mark.parametrize(
"func",
[
"assert_equal",
"assert_identical",
"assert_allclose",
"assert_duckarray_equal",
"assert_duckarray_allclose",
],
)
def test_ensure_warnings_not_elevated(func) -> None:
# make sure warnings are not elevated to errors in the assertion functions
# e.g. by @pytest.mark.filterwarnings("error")
# see https://github.com/pydata/xarray/pull/4760#issuecomment-774101639
# define a custom Variable class that raises a warning in assert_*
class WarningVariable(xr.Variable):
@property # type: ignore[misc]
def dims(self):
warnings.warn("warning in test")
return super().dims
def __array__(self, dtype=None, copy=None):
warnings.warn("warning in test")
return super().__array__()
a = WarningVariable("x", [1])
b = WarningVariable("x", [2])
with warnings.catch_warnings(record=True) as w:
# elevate warnings to errors
warnings.filterwarnings("error")
with pytest.raises(AssertionError):
> getattr(xr.testing, func)(a, b)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_assertions.py#x1B[0m:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\testing\assertions.py#x1B[0m:294: in _format_message
diff = x - y
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:590: in __sub__
from xarray.namedarray._array_api import asarray, subtract
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
if attr in __former_attrs__:
> raise AttributeError(__former_attrs__[attr])
#x1B[1m#x1B[31mE AttributeError: module 'numpy' has no attribute 'bool'.#x1B[0m
#x1B[1m#x1B[31mE `np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.#x1B[0m
#x1B[1m#x1B[31mE The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:#x1B[0m
#x1B[1m#x1B[31mE https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'bool_'?#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:324: AttributeError
Check warning on line 0 in xarray.tests.test_backends.TestNetCDF4Data
github-actions / Test Results
3 out of 9 runs failed: test_isel_dataarray (xarray.tests.test_backends.TestNetCDF4Data)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_backends.TestNetCDF4Data object at 0x00000187DEDC6390>
def test_isel_dataarray(self) -> None:
# Make sure isel works lazily. GH:issue:1688
in_memory = create_test_data()
with self.roundtrip(in_memory) as on_disk:
> expected = in_memory.isel(dim2=in_memory["dim2"] < 3)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:800:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:283: in __lt__
return self._binary_op(other, operator.lt)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:528: in __lt__
from xarray.namedarray._array_api import asarray, less
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_backends.TestH5NetCDFFileObject
github-actions / Test Results
3 out of 9 runs failed: test_isel_dataarray (xarray.tests.test_backends.TestH5NetCDFFileObject)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_backends.TestH5NetCDFFileObject object at 0x000001254F06E7B0>
def test_isel_dataarray(self) -> None:
# Make sure isel works lazily. GH:issue:1688
in_memory = create_test_data()
with self.roundtrip(in_memory) as on_disk:
> expected = in_memory.isel(dim2=in_memory["dim2"] < 3)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:800:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:283: in __lt__
return self._binary_op(other, operator.lt)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:528: in __lt__
from xarray.namedarray._array_api import asarray, less
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_backends.TestZarrKVStoreV3
github-actions / Test Results
3 out of 9 runs failed: test_write_read_select_write (xarray.tests.test_backends.TestZarrKVStoreV3)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_backends.TestZarrKVStoreV3 object at 0x000001FE11CDDB50>
def test_write_read_select_write(self) -> None:
# Test for https://github.com/pydata/xarray/issues/4084
ds = create_test_data()
# NOTE: using self.roundtrip, which uses open_dataset, will not trigger the bug.
with self.create_zarr_target() as initial_store:
ds.to_zarr(initial_store, mode="w", **self.version_kwargs)
ds1 = xr.open_zarr(initial_store, **self.version_kwargs)
# Combination of where+squeeze triggers error on write.
> ds_sel = ds1.where(ds1.coords["dim3"] == "a", drop=True).squeeze("dim3")
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:3070:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:295: in __eq__
return self._binary_op(other, nputils.array_eq)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\nputils.py#x1B[0m:113: in array_eq
return _ensure_bool_is_ndarray(self == other, self, other)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:467: in __eq__
from xarray.namedarray._array_api import asarray, equal
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_backends.TestH5NetCDFFileObject
github-actions / Test Results
3 out of 9 runs failed: test_append_overwrite_values (xarray.tests.test_backends.TestH5NetCDFFileObject)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_backends.TestH5NetCDFFileObject object at 0x000001254F12B5C0>
def test_append_overwrite_values(self) -> None:
# regression for GH1215
data = create_test_data()
with create_tmp_file(allow_cleanup_failure=False) as tmp_file:
self.save(data, tmp_file, mode="w")
data["var2"][:] = -999
> data["var9"] = data["var2"] * 3
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:1346:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:253: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:543: in __mul__
from xarray.namedarray._array_api import asarray, multiply
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_backends.TestH5NetCDFFileObject
github-actions / Test Results
3 out of 9 runs failed: test_append_with_invalid_dim_raises (xarray.tests.test_backends.TestH5NetCDFFileObject)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_backends.TestH5NetCDFFileObject object at 0x000001254F12A930>
def test_append_with_invalid_dim_raises(self) -> None:
data = create_test_data()
with create_tmp_file(allow_cleanup_failure=False) as tmp_file:
self.save(data, tmp_file, mode="w")
> data["var9"] = data["var2"] * 3
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:1355:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:253: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:543: in __mul__
from xarray.namedarray._array_api import asarray, multiply
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_backends.TestNetCDF4Data
github-actions / Test Results
3 out of 9 runs failed: test_append_overwrite_values (xarray.tests.test_backends.TestNetCDF4Data)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_backends.TestNetCDF4Data object at 0x00000187DEDDA0C0>
def test_append_overwrite_values(self) -> None:
# regression for GH1215
data = create_test_data()
with create_tmp_file(allow_cleanup_failure=False) as tmp_file:
self.save(data, tmp_file, mode="w")
data["var2"][:] = -999
> data["var9"] = data["var2"] * 3
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:1346:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:253: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataarray.py#x1B[0m:4749: in _binary_op
f(self.variable, other_variable_or_arraylike)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:543: in __mul__
from xarray.namedarray._array_api import asarray, multiply
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning
Check warning on line 0 in xarray.tests.test_backends.TestH5NetCDFFileObject
github-actions / Test Results
3 out of 9 runs failed: test_write_groups (xarray.tests.test_backends.TestH5NetCDFFileObject)
artifacts/Test results for Linux-3.10 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Windows-3.10/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
Raw output
FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
self = <xarray.tests.test_backends.TestH5NetCDFFileObject object at 0x000001254F124860>
def test_write_groups(self) -> None:
data1 = create_test_data()
> data2 = data1 * 2
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\tests\test_backends.py#x1B[0m:1493:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\_typed_ops.py#x1B[0m:41: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataset.py#x1B[0m:7778: in _binary_op
ds = self._calculate_binary_op(g, other, join=align_type)
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\core\dataset.py#x1B[0m:7847: in _calculate_binary_op
new_vars = {k: f(self.variables[k], other_variable) for k in self.data_vars}
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\core.py#x1B[0m:543: in __mul__
from xarray.namedarray._array_api import asarray, multiply
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\__init__.py#x1B[0m:69: in <module>
from xarray.namedarray._array_api._dtypes import (
#x1B[1m#x1B[31mD:\a\xarray\xarray\xarray\namedarray\_array_api\_dtypes.py#x1B[0m:18: in <module>
bool = _xp.bool
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attr = 'bool'
def __getattr__(attr):
# Warn for expired attributes, and return a dummy function
# that always raises an exception.
import warnings
import math
try:
msg = __expired_functions__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
def _expired(*args, **kwds):
raise RuntimeError(msg)
return _expired
# Emit warnings for deprecated attributes
try:
val, msg = __deprecated_attrs__[attr]
except KeyError:
pass
else:
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return val
if attr in __future_scalars__:
# And future warnings for those that will change, but also give
# the AttributeError
> warnings.warn(
f"In the future `np.{attr}` will be defined as the "
"corresponding NumPy scalar.", FutureWarning, stacklevel=2)
#x1B[1m#x1B[31mE FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.#x1B[0m
#x1B[1m#x1B[31mC:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\__init__.py#x1B[0m:319: FutureWarning