Add support for Array API in NamedArray #22
67 errors, 6 642 fail, 1 598 skipped, 11 566 pass in 1h 30m 40s
Annotations
github-actions / Test Results
6 out of 8 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 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/core/_typed_ops.py#x1B[0m:483: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2318: in _binary_op
self_data, other_data, dims = _broadcast_compat_data(self, other)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2928: in _broadcast_compat_data
new_self, new_other = _broadcast_compat_variables(self, other)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2895: in _broadcast_compat_variables
return tuple(var.set_dims(dims) if var.dims != dims else var for var in variables)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2895: in <genexpr>
return tuple(var.set_dims(dims) if var.dims != dims else var for var in variables)
#x1B[1m#x1B[31mxarray/util/deprecation_helpers.py#x1B[0m:141: in wrapper
return func(*args, **kwargs)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:1389: in set_dims
return expanded_var.transpose(*dim)
#x1B[1m#x1B[31mxarray/util/deprecation_helpers.py#x1B[0m:141: in wrapper
return func(*args, **kwargs)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:1332: in transpose
axes = self.get_axis_num(dim)
#x1B[1m#x1B[31mxarray/namedarray/core.py#x1B[0m:803: in get_axis_num
if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#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/core/_typed_ops.py#x1B[0m:483: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2318: in _binary_op
self_data, other_data, dims = _broadcast_compat_data(self, other)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2928: in _broadcast_compat_data
new_self, new_other = _broadcast_compat_variables(self, other)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2895: in _broadcast_compat_variables
return tuple(var.set_dims(dims) if var.dims != dims else var for var in variables)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2895: in <genexpr>
return tuple(var.set_dims(dims) if var.dims != dims else var for var in variables)
#x1B[1m#x1B[31mxarray/util/deprecation_helpers.py#x1B[0m:141: in wrapper
return func(*args, **kwargs)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:1389: in set_dims
return expanded_var.transpose(*dim)
#x1B[1m#x1B[31mxarray/util/deprecation_helpers.py#x1B[0m:141: in wrapper
return func(*args, **kwargs)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:1332: in transpose
axes = self.get_axis_num(dim)
#x1B[1m#x1B[31mxarray/namedarray/core.py#x1B[0m:803: in get_axis_num
if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#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/core/_typed_ops.py#x1B[0m:483: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2318: in _binary_op
self_data, other_data, dims = _broadcast_compat_data(self, other)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2928: in _broadcast_compat_data
new_self, new_other = _broadcast_compat_variables(self, other)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2895: in _broadcast_compat_variables
return tuple(var.set_dims(dims) if var.dims != dims else var for var in variables)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2895: in <genexpr>
return tuple(var.set_dims(dims) if var.dims != dims else var for var in variables)
#x1B[1m#x1B[31mxarray/util/deprecation_helpers.py#x1B[0m:141: in wrapper
return func(*args, **kwargs)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:1389: in set_dims
return expanded_var.transpose(*dim)
#x1B[1m#x1B[31mxarray/util/deprecation_helpers.py#x1B[0m:141: in wrapper
return func(*args, **kwargs)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:1332: in transpose
axes = self.get_axis_num(dim)
#x1B[1m#x1B[31mxarray/namedarray/core.py#x1B[0m:803: in get_axis_num
if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#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/core/_typed_ops.py#x1B[0m:483: in __mul__
return self._binary_op(other, operator.mul)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2318: in _binary_op
self_data, other_data, dims = _broadcast_compat_data(self, other)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2928: in _broadcast_compat_data
new_self, new_other = _broadcast_compat_variables(self, other)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2895: in _broadcast_compat_variables
return tuple(var.set_dims(dims) if var.dims != dims else var for var in variables)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:2895: in <genexpr>
return tuple(var.set_dims(dims) if var.dims != dims else var for var in variables)
#x1B[1m#x1B[31mxarray/util/deprecation_helpers.py#x1B[0m:141: in wrapper
return func(*args, **kwargs)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:1389: in set_dims
return expanded_var.transpose(*dim)
#x1B[1m#x1B[31mxarray/util/deprecation_helpers.py#x1B[0m:141: in wrapper
return func(*args, **kwargs)
#x1B[1m#x1B[31mxarray/core/variable.py#x1B[0m:1332: in transpose
axes = self.get_axis_num(dim)
#x1B[1m#x1B[31mxarray/namedarray/core.py#x1B[0m:803: in get_axis_num
if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 7 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]
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 macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
AttributeError: 'Variable' object has no attribute '_dims_to_axes'. Did you mean: '_dim_to_axis'?
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f6cc4feb760>
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:2984:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/common.py#x1B[0m:1207: in where
indexers[dim] = _get_indexer(dim)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/common.py#x1B[0m:1192: in _dataarray_indexer
return cond.any(dim=(d for d in cond.dims if d != dim))
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/_aggregations.py#x1B[0m:1424: in any
return self.reduce(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataarray.py#x1B[0m:3831: in reduce
var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1668: in reduce
result = super().reduce(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1022: in reduce
axis_ = _dims_to_axis(self, d, axislike)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <xarray.Variable (dim3: 10)> Size: 10B
array([ True, False, False, False, False, False, False, False, False,
False])
dims = (), axis = None
def _dims_to_axis(
x: NamedArray[Any, Any], dims: _Dim | _Dims | Default, axis: _AxisLike | None
) -> _AxisLike | None:
"""
Convert dims to axis indices.
Examples
--------
>>> narr = NamedArray(("x", "y"), np.array([[1, 2, 3], [5, 6, 7]]))
>>> _dims_to_axis(narr, ("y",), None)
(1,)
>>> _dims_to_axis(narr, None, 0)
(0,)
>>> _dims_to_axis(narr, None, None)
"""
_assert_either_dim_or_axis(dims, axis)
if dims is not _default:
> return x._dims_to_axes(dims)
#x1B[1m#x1B[31mE AttributeError: 'Variable' object has no attribute '_dims_to_axes'. Did you mean: '_dim_to_axis'?#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:151: AttributeError
Check warning on line 0 in xarray.tests.test_backends
github-actions / Test Results
5 out of 7 runs failed: test_open_mfdataset_list_attr (xarray.tests.test_backends)
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/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
NameError: name 'dims' is not defined
@requires_netCDF4
@requires_dask
def test_open_mfdataset_list_attr() -> None:
"""
Case when an attribute of type list differs across the multiple files
"""
from netCDF4 import Dataset
with create_tmp_files(2) as nfiles:
for i in range(2):
with Dataset(nfiles[i], "w") as f:
f.createDimension("x", 3)
vlvar = f.createVariable("test_var", np.int32, ("x"))
# here create an attribute as a list
vlvar.test_attr = [f"string a {i}", f"string b {i}"]
vlvar[:] = np.arange(3)
with open_dataset(nfiles[0]) as ds1:
with open_dataset(nfiles[1]) as ds2:
> original = xr.concat([ds1, ds2], dim="x")
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:4077:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (x: 3)> Size: 12B
[3 values with dtype=int32]
Attributes:
test_attr: ['string a 0', 'string b 0']
dim = 'x'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw
github-actions / Test Results
5 out of 7 runs failed: test_open_mfdataset_does_same_as_concat[outer-all-nested-t] (xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw)
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/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
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw object at 0x7f0cfacd9e70>
combine = 'nested', concat_dim = 't', opt = 'all', join = 'outer'
@pytest.mark.parametrize(
"combine, concat_dim", [("nested", "t"), ("by_coords", None)]
)
@pytest.mark.parametrize("opt", ["all", "minimal", "different"])
@pytest.mark.parametrize("join", ["outer", "inner", "left", "right"])
def test_open_mfdataset_does_same_as_concat(
self, combine, concat_dim, opt, join
) -> None:
with self.setup_files_and_datasets() as (files, [ds1, ds2]):
if combine == "by_coords":
files.reverse()
> with open_mfdataset(
files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join
) as ds:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:4139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1135: in open_mfdataset
combined = _nested_combine(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:358: in _nested_combine
combined = _combine_nd(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:234: in _combine_nd
combined_ids = _combine_all_along_first_dim(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:269: in _combine_all_along_first_dim
new_combined_ids[new_id] = _combine_1d(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:292: in _combine_1d
combined = concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (t: 10, x: 10)> Size: 800B
dask.array<open_dataset-v1, shape=(10, 10), dtype=float64, chunksize=(10, 10), chunktype=numpy.ndarray>
dim = 't'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw
github-actions / Test Results
5 out of 7 runs failed: test_open_mfdataset_does_same_as_concat[outer-all-by_coords-None] (xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw)
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/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
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw object at 0x7f0cfacd9ab0>
combine = 'by_coords', concat_dim = None, opt = 'all', join = 'outer'
@pytest.mark.parametrize(
"combine, concat_dim", [("nested", "t"), ("by_coords", None)]
)
@pytest.mark.parametrize("opt", ["all", "minimal", "different"])
@pytest.mark.parametrize("join", ["outer", "inner", "left", "right"])
def test_open_mfdataset_does_same_as_concat(
self, combine, concat_dim, opt, join
) -> None:
with self.setup_files_and_datasets() as (files, [ds1, ds2]):
if combine == "by_coords":
files.reverse()
> with open_mfdataset(
files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join
) as ds:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:4139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1148: in open_mfdataset
combined = combine_by_coords(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:960: in combine_by_coords
concatenated_grouped_by_data_vars = tuple(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:961: in <genexpr>
_combine_single_variable_hypercube(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:632: in _combine_single_variable_hypercube
concatenated = _combine_nd(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:234: in _combine_nd
combined_ids = _combine_all_along_first_dim(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:269: in _combine_all_along_first_dim
new_combined_ids[new_id] = _combine_1d(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:292: in _combine_1d
combined = concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (t: 10, x: 10)> Size: 800B
dask.array<open_dataset-v1, shape=(10, 10), dtype=float64, chunksize=(10, 10), chunktype=numpy.ndarray>
dim = 't'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 7 runs failed: test_write_empty[True-True] (xarray.tests.test_backends.TestZarrWriteEmpty)
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 macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f6cc4fba800>
consolidated = True, write_empty = True
@pytest.mark.parametrize("consolidated", [True, False, None])
@pytest.mark.parametrize("write_empty", [True, False, None])
def test_write_empty(
self, consolidated: bool | None, write_empty: bool | None
) -> None:
if write_empty is False:
expected = ["0.1.0", "1.1.0"]
else:
expected = [
"0.0.0",
"0.0.1",
"0.1.0",
"0.1.1",
"1.0.0",
"1.0.1",
"1.1.0",
"1.1.1",
]
ds = xr.Dataset(
data_vars={
"test": (
("Z", "Y", "X"),
np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)),
)
}
)
if has_dask:
ds["test"] = ds["test"].chunk(1)
encoding = None
else:
encoding = {"test": {"chunks": (1, 1, 1)}}
with self.temp_dir() as (d, store):
ds.to_zarr(
store,
mode="w",
encoding=encoding,
write_empty_chunks=write_empty,
)
with self.roundtrip_dir(
ds,
store,
{"mode": "a", "append_dim": "Z", "write_empty_chunks": write_empty},
) as a_ds:
> expected_ds = xr.concat([ds, ds], dim="Z")
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:3295:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (Z: 1, Y: 2, X: 2)> Size: 32B
dask.array<xarray-<this-array>, shape=(1, 2, 2), dtype=float64, chunksize=(1, 1, 1), chunktype=numpy.ndarray>
dim = 'Z'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw
github-actions / Test Results
5 out of 7 runs failed: test_open_mfdataset_does_same_as_concat[outer-minimal-nested-t] (xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw)
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/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
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw object at 0x7f0cfacd9b70>
combine = 'nested', concat_dim = 't', opt = 'minimal', join = 'outer'
@pytest.mark.parametrize(
"combine, concat_dim", [("nested", "t"), ("by_coords", None)]
)
@pytest.mark.parametrize("opt", ["all", "minimal", "different"])
@pytest.mark.parametrize("join", ["outer", "inner", "left", "right"])
def test_open_mfdataset_does_same_as_concat(
self, combine, concat_dim, opt, join
) -> None:
with self.setup_files_and_datasets() as (files, [ds1, ds2]):
if combine == "by_coords":
files.reverse()
> with open_mfdataset(
files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join
) as ds:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:4139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1135: in open_mfdataset
combined = _nested_combine(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:358: in _nested_combine
combined = _combine_nd(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:234: in _combine_nd
combined_ids = _combine_all_along_first_dim(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:269: in _combine_all_along_first_dim
new_combined_ids[new_id] = _combine_1d(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:292: in _combine_1d
combined = concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (t: 10, x: 10)> Size: 800B
dask.array<open_dataset-v1, shape=(10, 10), dtype=float64, chunksize=(10, 10), chunktype=numpy.ndarray>
dim = 't'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 7 runs failed: test_write_empty[True-False] (xarray.tests.test_backends.TestZarrWriteEmpty)
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 macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f6cc4fba7a0>
consolidated = False, write_empty = True
@pytest.mark.parametrize("consolidated", [True, False, None])
@pytest.mark.parametrize("write_empty", [True, False, None])
def test_write_empty(
self, consolidated: bool | None, write_empty: bool | None
) -> None:
if write_empty is False:
expected = ["0.1.0", "1.1.0"]
else:
expected = [
"0.0.0",
"0.0.1",
"0.1.0",
"0.1.1",
"1.0.0",
"1.0.1",
"1.1.0",
"1.1.1",
]
ds = xr.Dataset(
data_vars={
"test": (
("Z", "Y", "X"),
np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)),
)
}
)
if has_dask:
ds["test"] = ds["test"].chunk(1)
encoding = None
else:
encoding = {"test": {"chunks": (1, 1, 1)}}
with self.temp_dir() as (d, store):
ds.to_zarr(
store,
mode="w",
encoding=encoding,
write_empty_chunks=write_empty,
)
with self.roundtrip_dir(
ds,
store,
{"mode": "a", "append_dim": "Z", "write_empty_chunks": write_empty},
) as a_ds:
> expected_ds = xr.concat([ds, ds], dim="Z")
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:3295:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (Z: 1, Y: 2, X: 2)> Size: 32B
dask.array<xarray-<this-array>, shape=(1, 2, 2), dtype=float64, chunksize=(1, 1, 1), chunktype=numpy.ndarray>
dim = 'Z'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw
github-actions / Test Results
5 out of 7 runs failed: test_open_mfdataset_does_same_as_concat[outer-minimal-by_coords-None] (xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw)
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/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
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw object at 0x7f0cfacd9c30>
combine = 'by_coords', concat_dim = None, opt = 'minimal', join = 'outer'
@pytest.mark.parametrize(
"combine, concat_dim", [("nested", "t"), ("by_coords", None)]
)
@pytest.mark.parametrize("opt", ["all", "minimal", "different"])
@pytest.mark.parametrize("join", ["outer", "inner", "left", "right"])
def test_open_mfdataset_does_same_as_concat(
self, combine, concat_dim, opt, join
) -> None:
with self.setup_files_and_datasets() as (files, [ds1, ds2]):
if combine == "by_coords":
files.reverse()
> with open_mfdataset(
files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join
) as ds:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:4139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1148: in open_mfdataset
combined = combine_by_coords(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:960: in combine_by_coords
concatenated_grouped_by_data_vars = tuple(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:961: in <genexpr>
_combine_single_variable_hypercube(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:632: in _combine_single_variable_hypercube
concatenated = _combine_nd(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:234: in _combine_nd
combined_ids = _combine_all_along_first_dim(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:269: in _combine_all_along_first_dim
new_combined_ids[new_id] = _combine_1d(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:292: in _combine_1d
combined = concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (t: 10, x: 10)> Size: 800B
dask.array<open_dataset-v1, shape=(10, 10), dtype=float64, chunksize=(10, 10), chunktype=numpy.ndarray>
dim = 't'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 7 runs failed: test_write_empty[True-None] (xarray.tests.test_backends.TestZarrWriteEmpty)
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 macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f6cc4fba5f0>
consolidated = None, write_empty = True
@pytest.mark.parametrize("consolidated", [True, False, None])
@pytest.mark.parametrize("write_empty", [True, False, None])
def test_write_empty(
self, consolidated: bool | None, write_empty: bool | None
) -> None:
if write_empty is False:
expected = ["0.1.0", "1.1.0"]
else:
expected = [
"0.0.0",
"0.0.1",
"0.1.0",
"0.1.1",
"1.0.0",
"1.0.1",
"1.1.0",
"1.1.1",
]
ds = xr.Dataset(
data_vars={
"test": (
("Z", "Y", "X"),
np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)),
)
}
)
if has_dask:
ds["test"] = ds["test"].chunk(1)
encoding = None
else:
encoding = {"test": {"chunks": (1, 1, 1)}}
with self.temp_dir() as (d, store):
ds.to_zarr(
store,
mode="w",
encoding=encoding,
write_empty_chunks=write_empty,
)
with self.roundtrip_dir(
ds,
store,
{"mode": "a", "append_dim": "Z", "write_empty_chunks": write_empty},
) as a_ds:
> expected_ds = xr.concat([ds, ds], dim="Z")
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:3295:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (Z: 1, Y: 2, X: 2)> Size: 32B
dask.array<xarray-<this-array>, shape=(1, 2, 2), dtype=float64, chunksize=(1, 1, 1), chunktype=numpy.ndarray>
dim = 'Z'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw
github-actions / Test Results
5 out of 7 runs failed: test_open_mfdataset_does_same_as_concat[outer-different-nested-t] (xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw)
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/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
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw object at 0x7f0cfacd9cf0>
combine = 'nested', concat_dim = 't', opt = 'different', join = 'outer'
@pytest.mark.parametrize(
"combine, concat_dim", [("nested", "t"), ("by_coords", None)]
)
@pytest.mark.parametrize("opt", ["all", "minimal", "different"])
@pytest.mark.parametrize("join", ["outer", "inner", "left", "right"])
def test_open_mfdataset_does_same_as_concat(
self, combine, concat_dim, opt, join
) -> None:
with self.setup_files_and_datasets() as (files, [ds1, ds2]):
if combine == "by_coords":
files.reverse()
> with open_mfdataset(
files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join
) as ds:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:4139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1135: in open_mfdataset
combined = _nested_combine(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:358: in _nested_combine
combined = _combine_nd(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:234: in _combine_nd
combined_ids = _combine_all_along_first_dim(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:269: in _combine_all_along_first_dim
new_combined_ids[new_id] = _combine_1d(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:292: in _combine_1d
combined = concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (t: 10, x: 10)> Size: 800B
dask.array<open_dataset-v1, shape=(10, 10), dtype=float64, chunksize=(10, 10), chunktype=numpy.ndarray>
dim = 't'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 7 runs failed: test_write_empty[False-True] (xarray.tests.test_backends.TestZarrWriteEmpty)
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 macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f6cc4fbac50>
consolidated = True, write_empty = False
@pytest.mark.parametrize("consolidated", [True, False, None])
@pytest.mark.parametrize("write_empty", [True, False, None])
def test_write_empty(
self, consolidated: bool | None, write_empty: bool | None
) -> None:
if write_empty is False:
expected = ["0.1.0", "1.1.0"]
else:
expected = [
"0.0.0",
"0.0.1",
"0.1.0",
"0.1.1",
"1.0.0",
"1.0.1",
"1.1.0",
"1.1.1",
]
ds = xr.Dataset(
data_vars={
"test": (
("Z", "Y", "X"),
np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)),
)
}
)
if has_dask:
ds["test"] = ds["test"].chunk(1)
encoding = None
else:
encoding = {"test": {"chunks": (1, 1, 1)}}
with self.temp_dir() as (d, store):
ds.to_zarr(
store,
mode="w",
encoding=encoding,
write_empty_chunks=write_empty,
)
with self.roundtrip_dir(
ds,
store,
{"mode": "a", "append_dim": "Z", "write_empty_chunks": write_empty},
) as a_ds:
> expected_ds = xr.concat([ds, ds], dim="Z")
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:3295:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (Z: 1, Y: 2, X: 2)> Size: 32B
dask.array<xarray-<this-array>, shape=(1, 2, 2), dtype=float64, chunksize=(1, 1, 1), chunktype=numpy.ndarray>
dim = 'Z'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw
github-actions / Test Results
5 out of 7 runs failed: test_open_mfdataset_does_same_as_concat[outer-different-by_coords-None] (xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw)
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/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
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw object at 0x7f0cfacd9db0>
combine = 'by_coords', concat_dim = None, opt = 'different', join = 'outer'
@pytest.mark.parametrize(
"combine, concat_dim", [("nested", "t"), ("by_coords", None)]
)
@pytest.mark.parametrize("opt", ["all", "minimal", "different"])
@pytest.mark.parametrize("join", ["outer", "inner", "left", "right"])
def test_open_mfdataset_does_same_as_concat(
self, combine, concat_dim, opt, join
) -> None:
with self.setup_files_and_datasets() as (files, [ds1, ds2]):
if combine == "by_coords":
files.reverse()
> with open_mfdataset(
files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join
) as ds:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:4139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1148: in open_mfdataset
combined = combine_by_coords(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:960: in combine_by_coords
concatenated_grouped_by_data_vars = tuple(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:961: in <genexpr>
_combine_single_variable_hypercube(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:632: in _combine_single_variable_hypercube
concatenated = _combine_nd(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:234: in _combine_nd
combined_ids = _combine_all_along_first_dim(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:269: in _combine_all_along_first_dim
new_combined_ids[new_id] = _combine_1d(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:292: in _combine_1d
combined = concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (t: 10, x: 10)> Size: 800B
dask.array<open_dataset-v1, shape=(10, 10), dtype=float64, chunksize=(10, 10), chunktype=numpy.ndarray>
dim = 't'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 7 runs failed: test_write_empty[False-False] (xarray.tests.test_backends.TestZarrWriteEmpty)
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 macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f6cc4fbad10>
consolidated = False, write_empty = False
@pytest.mark.parametrize("consolidated", [True, False, None])
@pytest.mark.parametrize("write_empty", [True, False, None])
def test_write_empty(
self, consolidated: bool | None, write_empty: bool | None
) -> None:
if write_empty is False:
expected = ["0.1.0", "1.1.0"]
else:
expected = [
"0.0.0",
"0.0.1",
"0.1.0",
"0.1.1",
"1.0.0",
"1.0.1",
"1.1.0",
"1.1.1",
]
ds = xr.Dataset(
data_vars={
"test": (
("Z", "Y", "X"),
np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)),
)
}
)
if has_dask:
ds["test"] = ds["test"].chunk(1)
encoding = None
else:
encoding = {"test": {"chunks": (1, 1, 1)}}
with self.temp_dir() as (d, store):
ds.to_zarr(
store,
mode="w",
encoding=encoding,
write_empty_chunks=write_empty,
)
with self.roundtrip_dir(
ds,
store,
{"mode": "a", "append_dim": "Z", "write_empty_chunks": write_empty},
) as a_ds:
> expected_ds = xr.concat([ds, ds], dim="Z")
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:3295:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (Z: 1, Y: 2, X: 2)> Size: 32B
dask.array<xarray-<this-array>, shape=(1, 2, 2), dtype=float64, chunksize=(1, 1, 1), chunktype=numpy.ndarray>
dim = 'Z'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw
github-actions / Test Results
5 out of 7 runs failed: test_open_mfdataset_does_same_as_concat[inner-all-nested-t] (xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw)
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/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
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw object at 0x7f0cfacd98d0>
combine = 'nested', concat_dim = 't', opt = 'all', join = 'inner'
@pytest.mark.parametrize(
"combine, concat_dim", [("nested", "t"), ("by_coords", None)]
)
@pytest.mark.parametrize("opt", ["all", "minimal", "different"])
@pytest.mark.parametrize("join", ["outer", "inner", "left", "right"])
def test_open_mfdataset_does_same_as_concat(
self, combine, concat_dim, opt, join
) -> None:
with self.setup_files_and_datasets() as (files, [ds1, ds2]):
if combine == "by_coords":
files.reverse()
> with open_mfdataset(
files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join
) as ds:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:4139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1135: in open_mfdataset
combined = _nested_combine(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:358: in _nested_combine
combined = _combine_nd(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:234: in _combine_nd
combined_ids = _combine_all_along_first_dim(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:269: in _combine_all_along_first_dim
new_combined_ids[new_id] = _combine_1d(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:292: in _combine_1d
combined = concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (t: 10, x: 10)> Size: 800B
dask.array<open_dataset-v1, shape=(10, 10), dtype=float64, chunksize=(10, 10), chunktype=numpy.ndarray>
dim = 't'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 7 runs failed: test_write_empty[False-None] (xarray.tests.test_backends.TestZarrWriteEmpty)
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 macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f6cc4fbadd0>
consolidated = None, write_empty = False
@pytest.mark.parametrize("consolidated", [True, False, None])
@pytest.mark.parametrize("write_empty", [True, False, None])
def test_write_empty(
self, consolidated: bool | None, write_empty: bool | None
) -> None:
if write_empty is False:
expected = ["0.1.0", "1.1.0"]
else:
expected = [
"0.0.0",
"0.0.1",
"0.1.0",
"0.1.1",
"1.0.0",
"1.0.1",
"1.1.0",
"1.1.1",
]
ds = xr.Dataset(
data_vars={
"test": (
("Z", "Y", "X"),
np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)),
)
}
)
if has_dask:
ds["test"] = ds["test"].chunk(1)
encoding = None
else:
encoding = {"test": {"chunks": (1, 1, 1)}}
with self.temp_dir() as (d, store):
ds.to_zarr(
store,
mode="w",
encoding=encoding,
write_empty_chunks=write_empty,
)
with self.roundtrip_dir(
ds,
store,
{"mode": "a", "append_dim": "Z", "write_empty_chunks": write_empty},
) as a_ds:
> expected_ds = xr.concat([ds, ds], dim="Z")
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:3295:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (Z: 1, Y: 2, X: 2)> Size: 32B
dask.array<xarray-<this-array>, shape=(1, 2, 2), dtype=float64, chunksize=(1, 1, 1), chunktype=numpy.ndarray>
dim = 'Z'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw
github-actions / Test Results
5 out of 7 runs failed: test_open_mfdataset_does_same_as_concat[inner-all-by_coords-None] (xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw)
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/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
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw object at 0x7f0cfacda740>
combine = 'by_coords', concat_dim = None, opt = 'all', join = 'inner'
@pytest.mark.parametrize(
"combine, concat_dim", [("nested", "t"), ("by_coords", None)]
)
@pytest.mark.parametrize("opt", ["all", "minimal", "different"])
@pytest.mark.parametrize("join", ["outer", "inner", "left", "right"])
def test_open_mfdataset_does_same_as_concat(
self, combine, concat_dim, opt, join
) -> None:
with self.setup_files_and_datasets() as (files, [ds1, ds2]):
if combine == "by_coords":
files.reverse()
> with open_mfdataset(
files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join
) as ds:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:4139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1148: in open_mfdataset
combined = combine_by_coords(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:960: in combine_by_coords
concatenated_grouped_by_data_vars = tuple(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:961: in <genexpr>
_combine_single_variable_hypercube(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:632: in _combine_single_variable_hypercube
concatenated = _combine_nd(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:234: in _combine_nd
combined_ids = _combine_all_along_first_dim(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:269: in _combine_all_along_first_dim
new_combined_ids[new_id] = _combine_1d(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:292: in _combine_1d
combined = concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (t: 10, x: 10)> Size: 800B
dask.array<open_dataset-v1, shape=(10, 10), dtype=float64, chunksize=(10, 10), chunktype=numpy.ndarray>
dim = 't'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 7 runs failed: test_write_empty[None-True] (xarray.tests.test_backends.TestZarrWriteEmpty)
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 macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f6cc4fbae90>
consolidated = True, write_empty = None
@pytest.mark.parametrize("consolidated", [True, False, None])
@pytest.mark.parametrize("write_empty", [True, False, None])
def test_write_empty(
self, consolidated: bool | None, write_empty: bool | None
) -> None:
if write_empty is False:
expected = ["0.1.0", "1.1.0"]
else:
expected = [
"0.0.0",
"0.0.1",
"0.1.0",
"0.1.1",
"1.0.0",
"1.0.1",
"1.1.0",
"1.1.1",
]
ds = xr.Dataset(
data_vars={
"test": (
("Z", "Y", "X"),
np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)),
)
}
)
if has_dask:
ds["test"] = ds["test"].chunk(1)
encoding = None
else:
encoding = {"test": {"chunks": (1, 1, 1)}}
with self.temp_dir() as (d, store):
ds.to_zarr(
store,
mode="w",
encoding=encoding,
write_empty_chunks=write_empty,
)
with self.roundtrip_dir(
ds,
store,
{"mode": "a", "append_dim": "Z", "write_empty_chunks": write_empty},
) as a_ds:
> expected_ds = xr.concat([ds, ds], dim="Z")
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:3295:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (Z: 1, Y: 2, X: 2)> Size: 32B
dask.array<xarray-<this-array>, shape=(1, 2, 2), dtype=float64, chunksize=(1, 1, 1), chunktype=numpy.ndarray>
dim = 'Z'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_accessor_str
github-actions / Test Results
All 7 runs failed: test_contains_broadcast[str] (xarray.tests.test_accessor_str)
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 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 macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
AttributeError: 'Variable' object has no attribute '_dims_to_axes'. Did you mean: '_dim_to_axis'?
dtype = <class 'numpy.str_'>
def test_contains_broadcast(dtype) -> None:
values = xr.DataArray(["Foo", "xYz", "fOOomMm__fOo", "MMM_"], dims="X").astype(
dtype
)
pat_str = xr.DataArray(["FOO|mmm", "Foo", "MMM"], dims="Y").astype(dtype)
pat_re = xr.DataArray([re.compile(x) for x in pat_str.data], dims="Y")
# case insensitive using regex
result = values.str.contains(pat_str, case=False)
expected = xr.DataArray(
[
[True, True, False],
[False, False, False],
[True, True, True],
[True, False, True],
],
dims=["X", "Y"],
)
assert result.dtype == expected.dtype
assert_equal(result, expected)
# case sensitive using regex
result = values.str.contains(pat_str)
expected = xr.DataArray(
[
[False, True, False],
[False, False, False],
[False, False, False],
[False, False, True],
],
dims=["X", "Y"],
)
assert result.dtype == expected.dtype
assert_equal(result, expected)
> result = values.str.contains(pat_re)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_accessor_str.py#x1B[0m:181:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/accessor_str.py#x1B[0m:1491: in contains
is_compiled_re = _contains_compiled_re(pat)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/accessor_str.py#x1B[0m:104: in _contains_compiled_re
return _contains_obj_type(pat=pat, checker=re.Pattern)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/accessor_str.py#x1B[0m:88: in _contains_obj_type
return _apply_str_ufunc(func=checker, obj=pat).all()
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/_aggregations.py#x1B[0m:1358: in all
return self.reduce(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataarray.py#x1B[0m:3831: in reduce
var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1668: in reduce
result = super().reduce(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1022: in reduce
axis_ = _dims_to_axis(self, d, axislike)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <xarray.Variable (Y: 3)> Size: 24B
array([True, True, True], dtype=object)
dims = (<Default.token: 0>,), axis = None
def _dims_to_axis(
x: NamedArray[Any, Any], dims: _Dim | _Dims | Default, axis: _AxisLike | None
) -> _AxisLike | None:
"""
Convert dims to axis indices.
Examples
--------
>>> narr = NamedArray(("x", "y"), np.array([[1, 2, 3], [5, 6, 7]]))
>>> _dims_to_axis(narr, ("y",), None)
(1,)
>>> _dims_to_axis(narr, None, 0)
(0,)
>>> _dims_to_axis(narr, None, None)
"""
_assert_either_dim_or_axis(dims, axis)
if dims is not _default:
> return x._dims_to_axes(dims)
#x1B[1m#x1B[31mE AttributeError: 'Variable' object has no attribute '_dims_to_axes'. Did you mean: '_dim_to_axis'?#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:151: AttributeError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 7 runs failed: test_write_empty[None-False] (xarray.tests.test_backends.TestZarrWriteEmpty)
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 macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f6cc4fbaf50>
consolidated = False, write_empty = None
@pytest.mark.parametrize("consolidated", [True, False, None])
@pytest.mark.parametrize("write_empty", [True, False, None])
def test_write_empty(
self, consolidated: bool | None, write_empty: bool | None
) -> None:
if write_empty is False:
expected = ["0.1.0", "1.1.0"]
else:
expected = [
"0.0.0",
"0.0.1",
"0.1.0",
"0.1.1",
"1.0.0",
"1.0.1",
"1.1.0",
"1.1.1",
]
ds = xr.Dataset(
data_vars={
"test": (
("Z", "Y", "X"),
np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)),
)
}
)
if has_dask:
ds["test"] = ds["test"].chunk(1)
encoding = None
else:
encoding = {"test": {"chunks": (1, 1, 1)}}
with self.temp_dir() as (d, store):
ds.to_zarr(
store,
mode="w",
encoding=encoding,
write_empty_chunks=write_empty,
)
with self.roundtrip_dir(
ds,
store,
{"mode": "a", "append_dim": "Z", "write_empty_chunks": write_empty},
) as a_ds:
> expected_ds = xr.concat([ds, ds], dim="Z")
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:3295:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (Z: 1, Y: 2, X: 2)> Size: 32B
dask.array<xarray-<this-array>, shape=(1, 2, 2), dtype=float64, chunksize=(1, 1, 1), chunktype=numpy.ndarray>
dim = 'Z'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw
github-actions / Test Results
5 out of 7 runs failed: test_open_mfdataset_does_same_as_concat[inner-minimal-nested-t] (xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw)
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/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
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw object at 0x7f0cfac87850>
combine = 'nested', concat_dim = 't', opt = 'minimal', join = 'inner'
@pytest.mark.parametrize(
"combine, concat_dim", [("nested", "t"), ("by_coords", None)]
)
@pytest.mark.parametrize("opt", ["all", "minimal", "different"])
@pytest.mark.parametrize("join", ["outer", "inner", "left", "right"])
def test_open_mfdataset_does_same_as_concat(
self, combine, concat_dim, opt, join
) -> None:
with self.setup_files_and_datasets() as (files, [ds1, ds2]):
if combine == "by_coords":
files.reverse()
> with open_mfdataset(
files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join
) as ds:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:4139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1135: in open_mfdataset
combined = _nested_combine(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:358: in _nested_combine
combined = _combine_nd(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:234: in _combine_nd
combined_ids = _combine_all_along_first_dim(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:269: in _combine_all_along_first_dim
new_combined_ids[new_id] = _combine_1d(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:292: in _combine_1d
combined = concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (t: 10, x: 10)> Size: 800B
dask.array<open_dataset-v1, shape=(10, 10), dtype=float64, chunksize=(10, 10), chunktype=numpy.ndarray>
dim = 't'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_accessor_str
github-actions / Test Results
All 7 runs failed: test_contains_broadcast[bytes] (xarray.tests.test_accessor_str)
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 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 macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
AttributeError: 'Variable' object has no attribute '_dims_to_axes'. Did you mean: '_dim_to_axis'?
dtype = <class 'numpy.bytes_'>
def test_contains_broadcast(dtype) -> None:
values = xr.DataArray(["Foo", "xYz", "fOOomMm__fOo", "MMM_"], dims="X").astype(
dtype
)
pat_str = xr.DataArray(["FOO|mmm", "Foo", "MMM"], dims="Y").astype(dtype)
pat_re = xr.DataArray([re.compile(x) for x in pat_str.data], dims="Y")
# case insensitive using regex
result = values.str.contains(pat_str, case=False)
expected = xr.DataArray(
[
[True, True, False],
[False, False, False],
[True, True, True],
[True, False, True],
],
dims=["X", "Y"],
)
assert result.dtype == expected.dtype
assert_equal(result, expected)
# case sensitive using regex
result = values.str.contains(pat_str)
expected = xr.DataArray(
[
[False, True, False],
[False, False, False],
[False, False, False],
[False, False, True],
],
dims=["X", "Y"],
)
assert result.dtype == expected.dtype
assert_equal(result, expected)
> result = values.str.contains(pat_re)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_accessor_str.py#x1B[0m:181:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/accessor_str.py#x1B[0m:1491: in contains
is_compiled_re = _contains_compiled_re(pat)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/accessor_str.py#x1B[0m:104: in _contains_compiled_re
return _contains_obj_type(pat=pat, checker=re.Pattern)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/accessor_str.py#x1B[0m:88: in _contains_obj_type
return _apply_str_ufunc(func=checker, obj=pat).all()
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/_aggregations.py#x1B[0m:1358: in all
return self.reduce(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataarray.py#x1B[0m:3831: in reduce
var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1668: in reduce
result = super().reduce(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1022: in reduce
axis_ = _dims_to_axis(self, d, axislike)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <xarray.Variable (Y: 3)> Size: 24B
array([True, True, True], dtype=object)
dims = (<Default.token: 0>,), axis = None
def _dims_to_axis(
x: NamedArray[Any, Any], dims: _Dim | _Dims | Default, axis: _AxisLike | None
) -> _AxisLike | None:
"""
Convert dims to axis indices.
Examples
--------
>>> narr = NamedArray(("x", "y"), np.array([[1, 2, 3], [5, 6, 7]]))
>>> _dims_to_axis(narr, ("y",), None)
(1,)
>>> _dims_to_axis(narr, None, 0)
(0,)
>>> _dims_to_axis(narr, None, None)
"""
_assert_either_dim_or_axis(dims, axis)
if dims is not _default:
> return x._dims_to_axes(dims)
#x1B[1m#x1B[31mE AttributeError: 'Variable' object has no attribute '_dims_to_axes'. Did you mean: '_dim_to_axis'?#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:151: AttributeError
Check warning on line 0 in xarray.tests.test_backends.TestZarrWriteEmpty
github-actions / Test Results
6 out of 7 runs failed: test_write_empty[None-None] (xarray.tests.test_backends.TestZarrWriteEmpty)
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 macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestZarrWriteEmpty object at 0x7f6cc4fbb010>
consolidated = None, write_empty = None
@pytest.mark.parametrize("consolidated", [True, False, None])
@pytest.mark.parametrize("write_empty", [True, False, None])
def test_write_empty(
self, consolidated: bool | None, write_empty: bool | None
) -> None:
if write_empty is False:
expected = ["0.1.0", "1.1.0"]
else:
expected = [
"0.0.0",
"0.0.1",
"0.1.0",
"0.1.1",
"1.0.0",
"1.0.1",
"1.1.0",
"1.1.1",
]
ds = xr.Dataset(
data_vars={
"test": (
("Z", "Y", "X"),
np.array([np.nan, np.nan, 1.0, np.nan]).reshape((1, 2, 2)),
)
}
)
if has_dask:
ds["test"] = ds["test"].chunk(1)
encoding = None
else:
encoding = {"test": {"chunks": (1, 1, 1)}}
with self.temp_dir() as (d, store):
ds.to_zarr(
store,
mode="w",
encoding=encoding,
write_empty_chunks=write_empty,
)
with self.roundtrip_dir(
ds,
store,
{"mode": "a", "append_dim": "Z", "write_empty_chunks": write_empty},
) as a_ds:
> expected_ds = xr.concat([ds, ds], dim="Z")
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:3295:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (Z: 1, Y: 2, X: 2)> Size: 32B
dask.array<xarray-<this-array>, shape=(1, 2, 2), dtype=float64, chunksize=(1, 1, 1), chunktype=numpy.ndarray>
dim = 'Z'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw
github-actions / Test Results
5 out of 7 runs failed: test_open_mfdataset_does_same_as_concat[inner-minimal-by_coords-None] (xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw)
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/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
NameError: name 'dims' is not defined
self = <xarray.tests.test_backends.TestOpenMFDatasetWithDataVarsAndCoordsKw object at 0x7f0cfac9f790>
combine = 'by_coords', concat_dim = None, opt = 'minimal', join = 'inner'
@pytest.mark.parametrize(
"combine, concat_dim", [("nested", "t"), ("by_coords", None)]
)
@pytest.mark.parametrize("opt", ["all", "minimal", "different"])
@pytest.mark.parametrize("join", ["outer", "inner", "left", "right"])
def test_open_mfdataset_does_same_as_concat(
self, combine, concat_dim, opt, join
) -> None:
with self.setup_files_and_datasets() as (files, [ds1, ds2]):
if combine == "by_coords":
files.reverse()
> with open_mfdataset(
files, data_vars=opt, combine=combine, concat_dim=concat_dim, join=join
) as ds:
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_backends.py#x1B[0m:4139:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/backends/api.py#x1B[0m:1148: in open_mfdataset
combined = combine_by_coords(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:960: in combine_by_coords
concatenated_grouped_by_data_vars = tuple(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:961: in <genexpr>
_combine_single_variable_hypercube(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:632: in _combine_single_variable_hypercube
concatenated = _combine_nd(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:234: in _combine_nd
combined_ids = _combine_all_along_first_dim(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:269: in _combine_all_along_first_dim
new_combined_ids[new_id] = _combine_1d(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/combine.py#x1B[0m:292: in _combine_1d
combined = concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:277: in concat
return _dataset_concat(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/concat.py#x1B[0m:667: in _dataset_concat
combined_var = concat_vars(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:2992: in concat
return Variable.concat(variables, dim, positions, shortcut, combine_attrs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1741: in concat
axis = first_var.get_axis_num(dim)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable (t: 10, x: 10)> Size: 800B
dask.array<open_dataset-v1, shape=(10, 10), dtype=float64, chunksize=(10, 10), chunktype=numpy.ndarray>
dim = 't'
def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Parameters
----------
dim : str or iterable of str
Dimension name(s) for which to lookup axes.
Returns
-------
int or tuple of int
Axis number or numbers corresponding to the given dimensions.
"""
> if dims is _default:
#x1B[1m#x1B[31mE NameError: name 'dims' is not defined#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:803: NameError
Check warning on line 0 in xarray.tests.test_accessor_str
github-actions / Test Results
All 7 runs failed: test_replace_callable (xarray.tests.test_accessor_str)
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 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 macOS-3.10/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
AttributeError: 'Variable' object has no attribute '_dims_to_axes'. Did you mean: '_dim_to_axis'?
def test_replace_callable() -> None:
values = xr.DataArray(["fooBAD__barBAD"])
# test with callable
repl = lambda m: m.group(0).swapcase()
result = values.str.replace("[a-z][A-Z]{2}", repl, n=2)
exp = xr.DataArray(["foObaD__baRbaD"])
assert result.dtype == exp.dtype
assert_equal(result, exp)
# test regex named groups
values = xr.DataArray(["Foo Bar Baz"])
pat = r"(?P<first>\w+) (?P<middle>\w+) (?P<last>\w+)"
repl = lambda m: m.group("middle").swapcase()
result = values.str.replace(pat, repl)
exp = xr.DataArray(["bAR"])
assert result.dtype == exp.dtype
assert_equal(result, exp)
# test broadcast
values = xr.DataArray(["Foo Bar Baz"], dims=["x"])
pat = r"(?P<first>\w+) (?P<middle>\w+) (?P<last>\w+)"
repl2 = xr.DataArray(
[
lambda m: m.group("first").swapcase(),
lambda m: m.group("middle").swapcase(),
lambda m: m.group("last").swapcase(),
],
dims=["Y"],
)
> result = values.str.replace(pat, repl2)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/tests/test_accessor_str.py#x1B[0m:417:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/accessor_str.py#x1B[0m:1931: in replace
elif not _contains_callable(repl): # pragma: no cover
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/accessor_str.py#x1B[0m:109: in _contains_callable
return _contains_obj_type(pat=pat, checker=callable)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/accessor_str.py#x1B[0m:88: in _contains_obj_type
return _apply_str_ufunc(func=checker, obj=pat).all()
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/_aggregations.py#x1B[0m:1358: in all
return self.reduce(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/dataarray.py#x1B[0m:3831: in reduce
var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/core/variable.py#x1B[0m:1668: in reduce
result = super().reduce(
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:1022: in reduce
axis_ = _dims_to_axis(self, d, axislike)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
x = <xarray.Variable (Y: 3)> Size: 24B
array([True, True, True], dtype=object)
dims = (<Default.token: 0>,), axis = None
def _dims_to_axis(
x: NamedArray[Any, Any], dims: _Dim | _Dims | Default, axis: _AxisLike | None
) -> _AxisLike | None:
"""
Convert dims to axis indices.
Examples
--------
>>> narr = NamedArray(("x", "y"), np.array([[1, 2, 3], [5, 6, 7]]))
>>> _dims_to_axis(narr, ("y",), None)
(1,)
>>> _dims_to_axis(narr, None, 0)
(0,)
>>> _dims_to_axis(narr, None, None)
"""
_assert_either_dim_or_axis(dims, axis)
if dims is not _default:
> return x._dims_to_axes(dims)
#x1B[1m#x1B[31mE AttributeError: 'Variable' object has no attribute '_dims_to_axes'. Did you mean: '_dim_to_axis'?#x1B[0m
#x1B[1m#x1B[31m/home/runner/work/xarray/xarray/xarray/namedarray/core.py#x1B[0m:151: AttributeError