Skip to content

Move parallelcompat and chunkmanagers to NamedArray #13093

Move parallelcompat and chunkmanagers to NamedArray

Move parallelcompat and chunkmanagers to NamedArray #13093

GitHub Actions / Test Results failed Feb 1, 2024 in 0s

370 fail, 1 838 skipped, 17 459 pass in 1h 58m 23s

     12 files   -      1       12 suites   - 1   1h 58m 23s ⏱️ - 15m 46s
 19 667 tests ±     0   17 459 ✅ ±     0   1 838 💤 ±    0    370 ❌ ±  0 
208 225 runs   - 18 508  181 242 ✅  - 16 816  25 173 💤  - 1 440  1 810 ❌  - 252 

Results for commit ad21f96. ± Comparison against earlier commit 905bbef.

Annotations

Check warning on line 0 in xarray.tests.test_dask

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 10 runs failed: test_minimize_graph_size (xarray.tests.test_dask)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: (0, 6)
assert 0 == 6
def test_minimize_graph_size():
        # regression test for https://github.com/pydata/xarray/issues/8409
        ds = Dataset(
            {
                "foo": (
                    ("x", "y", "z"),
                    dask.array.ones((120, 120, 120), chunks=(20, 20, 1)),
                )
            },
            coords={"x": np.arange(120), "y": np.arange(120), "z": np.arange(120)},
        )
    
        mapped = ds.map_blocks(lambda x: x)
        graph = dict(mapped.__dask_graph__())
    
        numchunks = {k: len(v) for k, v in ds.chunksizes.items()}
        for var in "xyz":
            actual = len([key for key in graph if var in key[0]])
            # assert that we only include each chunk of an index variable
            # is only included once, not the product of number of chunks of
            # all the other dimenions.
            # e.g. previously for 'x',  actual == numchunks['y'] * numchunks['z']
>           assert actual == numchunks[var], (actual, numchunks[var])
E           AssertionError: (0, 6)
E           assert 0 == 6

/home/runner/work/xarray/xarray/xarray/tests/test_dask.py:1781: AssertionError

Check warning on line 0 in xarray.tests.test_dataset.TestDataset

See this annotation in the file changed.

@github-actions github-actions / Test Results

8 out of 12 runs failed: test_from_dataframe_sparse (xarray.tests.test_dataset.TestDataset)

artifacts/Test results for Linux-3.10 all-but-dask/pytest.xml [took 0s]
artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
TypeError: 'float' object is not subscriptable
self = <xarray.tests.test_dataset.TestDataset object at 0x7f3cb7043e50>

    @requires_sparse
    def test_from_dataframe_sparse(self) -> None:
        import sparse
    
        df_base = pd.DataFrame(
            {"x": range(10), "y": list("abcdefghij"), "z": np.arange(0, 100, 10)}
        )
    
        ds_sparse = Dataset.from_dataframe(df_base.set_index("x"), sparse=True)
        ds_dense = Dataset.from_dataframe(df_base.set_index("x"), sparse=False)
>       assert isinstance(ds_sparse["y"].data, sparse.COO)

/home/runner/work/xarray/xarray/xarray/tests/test_dataset.py:4746: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/core/dataarray.py:750: in data
    return self.variable.data
/home/runner/work/xarray/xarray/xarray/core/variable.py:410: in data
    if isinstance(self._data, _arrayfunction_or_api):
/home/runner/micromamba/envs/xarray-tests/lib/python3.9/typing.py:1149: in __instancecheck__
    if all(hasattr(instance, attr) and
/home/runner/micromamba/envs/xarray-tests/lib/python3.9/typing.py:1149: in <genexpr>
    if all(hasattr(instance, attr) and
/home/runner/micromamba/envs/xarray-tests/lib/python3.9/site-packages/sparse/_sparse_array.py:884: in real
    return self.__array_ufunc__(np.real, "__call__", self)
/home/runner/micromamba/envs/xarray-tests/lib/python3.9/site-packages/sparse/_sparse_array.py:305: in __array_ufunc__
    result = elemwise(ufunc, *inputs, **kwargs)
/home/runner/micromamba/envs/xarray-tests/lib/python3.9/site-packages/sparse/_umath.py:49: in elemwise
    return _Elemwise(func, *args, **kwargs).get_result()
/home/runner/micromamba/envs/xarray-tests/lib/python3.9/site-packages/sparse/_umath.py:466: in __init__
    self._get_fill_value()
/home/runner/micromamba/envs/xarray-tests/lib/python3.9/site-packages/sparse/_umath.py:535: in _get_fill_value
    zero_args = tuple(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

.0 = <tuple_iterator object at 0x7f3c8e5df4f0>

    zero_args = tuple(
>       arg.fill_value[...] if isinstance(arg, COO) else arg for arg in self.args
    )
E   TypeError: 'float' object is not subscriptable

/home/runner/micromamba/envs/xarray-tests/lib/python3.9/site-packages/sparse/_umath.py:536: TypeError

Check warning on line 0 in xarray.tests.test_dask

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 10 runs failed: test_map_blocks_error (xarray.tests.test_dask)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
Failed: DID NOT RAISE <class 'ValueError'>
map_da = <xarray.DataArray 'a' (x: 10, y: 20)>
dask.array<xarray-<this-array>, shape=(10, 20), dtype=float64, chunksize=(4, 5),...meta=np.ndarray>
    cxy      (x, y) int64 dask.array<chunksize=(4, 5), meta=np.ndarray>
Attributes:
    test:     test
map_ds = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...64 1 1 1 1
    e        (x, y) int64 100 101 102 103 104 105 ... 123 124 125 126 127 128
Attributes:
    test:     test

    def test_map_blocks_error(map_da, map_ds):
        def bad_func(darray):
            return (darray * darray.x + 5 * darray.y)[:1, :1]
    
        with pytest.raises(ValueError, match=r"Received dimension 'x' of length 1"):
>           xr.map_blocks(bad_func, map_da).compute()
E           Failed: DID NOT RAISE <class 'ValueError'>

/home/runner/work/xarray/xarray/xarray/tests/test_dask.py:1149: Failed

Check warning on line 0 in xarray.tests.test_dask

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 10 runs failed: test_map_blocks[obj1] (xarray.tests.test_dask)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError
obj = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...64 1 1 1 1
    e        (x, y) int64 100 101 102 103 104 105 ... 123 124 125 126 127 128
Attributes:
    test:     test

    @pytest.mark.parametrize("obj", [make_da(), make_ds()])
    def test_map_blocks(obj):
        def func(obj):
            result = obj + obj.x + 5 * obj.y
            return result
    
        with raise_if_dask_computes():
            actual = xr.map_blocks(func, obj)
        expected = func(obj)
>       assert_chunks_equal(expected.chunk(), actual)

/home/runner/work/xarray/xarray/xarray/tests/test_dask.py:1188: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...array<chunksize=(4, 10, 20), meta=np.ndarray>
    e        (x, y) int64 dask.array<chunksize=(10, 20), meta=np.ndarray>
b = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...1 516 521 526 ... 580 585 590 595 600 605
    e        (x, y) int64 600 606 612 618 624 630 ... 702 708 714 720 726 732

    def assert_chunks_equal(a, b):
        """
        Assert that chunksizes along chunked dimensions are equal.
    
        Parameters
        ----------
        a : xarray.Dataset or xarray.DataArray
            The first object to compare.
        b : xarray.Dataset or xarray.DataArray
            The second object to compare.
        """
    
        if isinstance(a, DataArray) != isinstance(b, DataArray):
            raise TypeError("a and b have mismatched types")
    
        left = a.unify_chunks()
        right = b.unify_chunks()
>       assert left.chunks == right.chunks
E       AssertionError

/home/runner/work/xarray/xarray/xarray/testing/assertions.py:255: AssertionError

Check warning on line 0 in xarray.tests.test_dask

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 10 runs failed: test_map_blocks_mixed_type_inputs[obj1] (xarray.tests.test_dask)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError
obj = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...64 1 1 1 1
    e        (x, y) int64 100 101 102 103 104 105 ... 123 124 125 126 127 128
Attributes:
    test:     test

    @pytest.mark.parametrize("obj", [make_da(), make_ds()])
    def test_map_blocks_mixed_type_inputs(obj):
        def func(obj1, non_xarray_input, obj2):
            result = obj1 + obj1.x + 5 * obj1.y
            return result
    
        with raise_if_dask_computes():
            actual = xr.map_blocks(func, obj, args=["non_xarray_input", obj])
        expected = func(obj, "non_xarray_input", obj)
>       assert_chunks_equal(expected.chunk(), actual)

/home/runner/work/xarray/xarray/xarray/tests/test_dask.py:1201: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...array<chunksize=(4, 10, 20), meta=np.ndarray>
    e        (x, y) int64 dask.array<chunksize=(10, 20), meta=np.ndarray>
b = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...1 516 521 526 ... 580 585 590 595 600 605
    e        (x, y) int64 600 606 612 618 624 630 ... 702 708 714 720 726 732

    def assert_chunks_equal(a, b):
        """
        Assert that chunksizes along chunked dimensions are equal.
    
        Parameters
        ----------
        a : xarray.Dataset or xarray.DataArray
            The first object to compare.
        b : xarray.Dataset or xarray.DataArray
            The second object to compare.
        """
    
        if isinstance(a, DataArray) != isinstance(b, DataArray):
            raise TypeError("a and b have mismatched types")
    
        left = a.unify_chunks()
        right = b.unify_chunks()
>       assert left.chunks == right.chunks
E       AssertionError

/home/runner/work/xarray/xarray/xarray/testing/assertions.py:255: AssertionError

Check warning on line 0 in xarray.tests.test_dask

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 10 runs failed: test_map_blocks_convert_args_to_list[obj1] (xarray.tests.test_dask)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError
obj = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...64 1 1 1 1
    e        (x, y) int64 100 101 102 103 104 105 ... 123 124 125 126 127 128
Attributes:
    test:     test

    @pytest.mark.parametrize("obj", [make_da(), make_ds()])
    def test_map_blocks_convert_args_to_list(obj):
        expected = obj + 10
        with raise_if_dask_computes():
            actual = xr.map_blocks(operator.add, obj, [10])
>       assert_chunks_equal(expected.chunk(), actual)

/home/runner/work/xarray/xarray/xarray/tests/test_dask.py:1210: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...ta=np.ndarray>
    e        (x, y) int64 dask.array<chunksize=(10, 20), meta=np.ndarray>
Attributes:
    test:     test
b = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...1 11 11 11
    e        (x, y) int64 110 111 112 113 114 115 ... 133 134 135 136 137 138
Attributes:
    test:     test

    def assert_chunks_equal(a, b):
        """
        Assert that chunksizes along chunked dimensions are equal.
    
        Parameters
        ----------
        a : xarray.Dataset or xarray.DataArray
            The first object to compare.
        b : xarray.Dataset or xarray.DataArray
            The second object to compare.
        """
    
        if isinstance(a, DataArray) != isinstance(b, DataArray):
            raise TypeError("a and b have mismatched types")
    
        left = a.unify_chunks()
        right = b.unify_chunks()
>       assert left.chunks == right.chunks
E       AssertionError

/home/runner/work/xarray/xarray/xarray/testing/assertions.py:255: AssertionError

Check warning on line 0 in xarray.tests.test_dask

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 10 runs failed: test_map_blocks_dask_args (xarray.tests.test_dask)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
Failed: DID NOT RAISE <class 'ValueError'>
def test_map_blocks_dask_args():
        da1 = xr.DataArray(
            np.ones((10, 20)),
            dims=["x", "y"],
            coords={"x": np.arange(10), "y": np.arange(20)},
        ).chunk({"x": 5, "y": 4})
    
        # check that block shapes are the same
        def sumda(da1, da2):
            assert da1.shape == da2.shape
            return da1 + da2
    
        da2 = da1 + 1
        with raise_if_dask_computes():
            mapped = xr.map_blocks(sumda, da1, args=[da2])
        xr.testing.assert_equal(da1 + da2, mapped)
    
        # one dimension in common
        da2 = (da1 + 1).isel(x=1, drop=True)
        with raise_if_dask_computes():
            mapped = xr.map_blocks(operator.add, da1, args=[da2])
        xr.testing.assert_equal(da1 + da2, mapped)
    
        # test that everything works when dimension names are different
        da2 = (da1 + 1).isel(x=1, drop=True).rename({"y": "k"})
        with raise_if_dask_computes():
            mapped = xr.map_blocks(operator.add, da1, args=[da2])
        xr.testing.assert_equal(da1 + da2, mapped)
    
        with pytest.raises(ValueError, match=r"Chunk sizes along dimension 'x'"):
>           xr.map_blocks(operator.add, da1, args=[da1.chunk({"x": 1})])
E           Failed: DID NOT RAISE <class 'ValueError'>

/home/runner/work/xarray/xarray/xarray/tests/test_dask.py:1244: Failed

Check warning on line 0 in xarray.tests.test_dask

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 10 runs failed: test_map_blocks_add_attrs[obj0] (xarray.tests.test_dask)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: Left and right DataArray objects are not identical

Differing coordinates:
L   cxy      (x, y) int64 dask.array<chunksize=(4, 5), meta=np.ndarray>
    Differing variable attributes:
        new2: new2
R   cxy      (x, y) int64 dask.array<chunksize=(4, 5), meta=np.ndarray>
Attributes only on the left object:
    new: new
obj = <xarray.DataArray 'a' (x: 10, y: 20)>
dask.array<xarray-<this-array>, shape=(10, 20), dtype=float64, chunksize=(4, 5),...meta=np.ndarray>
    cxy      (x, y) int64 dask.array<chunksize=(4, 5), meta=np.ndarray>
Attributes:
    test:     test

    @pytest.mark.parametrize("obj", [make_da(), make_ds()])
    def test_map_blocks_add_attrs(obj):
        def add_attrs(obj):
            obj = obj.copy(deep=True)
            obj.attrs["new"] = "new"
            obj.cxy.attrs["new2"] = "new2"
            return obj
    
        expected = add_attrs(obj)
        with raise_if_dask_computes():
            actual = xr.map_blocks(add_attrs, obj)
    
        assert_identical(actual, expected)
    
        # when template is specified, attrs are copied from template, not set by function
        with raise_if_dask_computes():
            actual = xr.map_blocks(add_attrs, obj, template=obj)
>       assert_identical(actual, obj)
E       AssertionError: Left and right DataArray objects are not identical
E       
E       Differing coordinates:
E       L   cxy      (x, y) int64 dask.array<chunksize=(4, 5), meta=np.ndarray>
E           Differing variable attributes:
E               new2: new2
E       R   cxy      (x, y) int64 dask.array<chunksize=(4, 5), meta=np.ndarray>
E       Attributes only on the left object:
E           new: new

/home/runner/work/xarray/xarray/xarray/tests/test_dask.py:1292: AssertionError

Check warning on line 0 in xarray.tests.test_dask

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 10 runs failed: test_map_blocks_add_attrs[obj1] (xarray.tests.test_dask)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: Left and right Dataset objects are not identical

Differing coordinates:
L   cxy      (x, y) int64 dask.array<chunksize=(4, 5), meta=np.ndarray>
    Differing variable attributes:
        new2: new2
R   cxy      (x, y) int64 dask.array<chunksize=(4, 5), meta=np.ndarray>

Attributes only on the left object:
    new: new
obj = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...64 1 1 1 1
    e        (x, y) int64 100 101 102 103 104 105 ... 123 124 125 126 127 128
Attributes:
    test:     test

    @pytest.mark.parametrize("obj", [make_da(), make_ds()])
    def test_map_blocks_add_attrs(obj):
        def add_attrs(obj):
            obj = obj.copy(deep=True)
            obj.attrs["new"] = "new"
            obj.cxy.attrs["new2"] = "new2"
            return obj
    
        expected = add_attrs(obj)
        with raise_if_dask_computes():
            actual = xr.map_blocks(add_attrs, obj)
    
        assert_identical(actual, expected)
    
        # when template is specified, attrs are copied from template, not set by function
        with raise_if_dask_computes():
            actual = xr.map_blocks(add_attrs, obj, template=obj)
>       assert_identical(actual, obj)
E       AssertionError: Left and right Dataset objects are not identical
E       
E       Differing coordinates:
E       L   cxy      (x, y) int64 dask.array<chunksize=(4, 5), meta=np.ndarray>
E           Differing variable attributes:
E               new2: new2
E       R   cxy      (x, y) int64 dask.array<chunksize=(4, 5), meta=np.ndarray>
E       
E       Attributes only on the left object:
E           new: new

/home/runner/work/xarray/xarray/xarray/tests/test_dask.py:1292: AssertionError

Check warning on line 0 in xarray.tests.test_dask

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 10 runs failed: test_map_blocks_kwargs[obj1] (xarray.tests.test_dask)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError
obj = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...64 1 1 1 1
    e        (x, y) int64 100 101 102 103 104 105 ... 123 124 125 126 127 128
Attributes:
    test:     test

    @pytest.mark.parametrize("obj", [make_da(), make_ds()])
    def test_map_blocks_kwargs(obj):
        expected = xr.full_like(obj, fill_value=np.nan)
        with raise_if_dask_computes():
            actual = xr.map_blocks(xr.full_like, obj, kwargs=dict(fill_value=np.nan))
>       assert_chunks_equal(expected.chunk(), actual)

/home/runner/work/xarray/xarray/xarray/tests/test_dask.py:1313: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

a = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...ta=np.ndarray>
    e        (x, y) int64 dask.array<chunksize=(10, 20), meta=np.ndarray>
Attributes:
    test:     test
b = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...3372036854775808
    e        (x, y) int64 -9223372036854775808 ... -9223372036854775808
Attributes:
    test:     test

    def assert_chunks_equal(a, b):
        """
        Assert that chunksizes along chunked dimensions are equal.
    
        Parameters
        ----------
        a : xarray.Dataset or xarray.DataArray
            The first object to compare.
        b : xarray.Dataset or xarray.DataArray
            The second object to compare.
        """
    
        if isinstance(a, DataArray) != isinstance(b, DataArray):
            raise TypeError("a and b have mismatched types")
    
        left = a.unify_chunks()
        right = b.unify_chunks()
>       assert left.chunks == right.chunks
E       AssertionError

/home/runner/work/xarray/xarray/xarray/testing/assertions.py:255: AssertionError

Check warning on line 0 in xarray.tests.test_dask

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 10 runs failed: test_map_blocks_da_ds_with_template[obj0] (xarray.tests.test_dask)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: Left and right DataArray objects are not identical
Differing dimensions:
    (x: 1, y: 20) != (x: 3, y: 20)
Differing values:
L
    dask.array<getitem, shape=(1, 20), dtype=float64, chunksize=(1, 5), chunktype=numpy.ndarray>
R
    dask.array<getitem, shape=(3, 20), dtype=float64, chunksize=(1, 5), chunktype=numpy.ndarray>
Differing coordinates:
L   ndcoord  (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
R   ndcoord  (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
L   cxy      (x, y) int64 dask.array<chunksize=(1, 5), meta=np.ndarray>
R   cxy      (x, y) int64 dask.array<chunksize=(1, 5), meta=np.ndarray>
L * x        (x) int64 1
R * x        (x) int64 1 5 9
obj = <xarray.DataArray 'a' (x: 10, y: 20)>
dask.array<xarray-<this-array>, shape=(10, 20), dtype=float64, chunksize=(4, 5),...meta=np.ndarray>
    cxy      (x, y) int64 dask.array<chunksize=(4, 5), meta=np.ndarray>
Attributes:
    test:     test

    @pytest.mark.parametrize("obj", [make_da(), make_ds()])
    def test_map_blocks_da_ds_with_template(obj):
        func = lambda x: x.isel(x=[1])
        template = obj.isel(x=[1, 5, 9])
        with raise_if_dask_computes():
            actual = xr.map_blocks(func, obj, template=template)
>       assert_identical(actual, template)
E       AssertionError: Left and right DataArray objects are not identical
E       Differing dimensions:
E           (x: 1, y: 20) != (x: 3, y: 20)
E       Differing values:
E       L
E           dask.array<getitem, shape=(1, 20), dtype=float64, chunksize=(1, 5), chunktype=numpy.ndarray>
E       R
E           dask.array<getitem, shape=(3, 20), dtype=float64, chunksize=(1, 5), chunktype=numpy.ndarray>
E       Differing coordinates:
E       L   ndcoord  (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
E       R   ndcoord  (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
E       L   cxy      (x, y) int64 dask.array<chunksize=(1, 5), meta=np.ndarray>
E       R   cxy      (x, y) int64 dask.array<chunksize=(1, 5), meta=np.ndarray>
E       L * x        (x) int64 1
E       R * x        (x) int64 1 5 9

/home/runner/work/xarray/xarray/xarray/tests/test_dask.py:1371: AssertionError

Check warning on line 0 in xarray.tests.test_dask

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 10 runs failed: test_map_blocks_da_ds_with_template[obj1] (xarray.tests.test_dask)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: Left and right Dataset objects are not identical
Differing dimensions:
    (x: 1, y: 20, z: 4) != (x: 3, y: 20, z: 4)
Differing coordinates:
L   ndcoord  (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
R   ndcoord  (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
L   xx       (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>
R   xx       (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>
L   cxy      (x, y) int64 dask.array<chunksize=(1, 5), meta=np.ndarray>
R   cxy      (x, y) int64 dask.array<chunksize=(1, 5), meta=np.ndarray>
L * x        (x) int64 1
R * x        (x) int64 1 5 9
L   cx       (x) int64 1
R   cx       (x) int64 1 5 9
Differing data variables:
L   b        (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>
R   b        (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>
L   e        (x, y) int64 101 102 103 104 105 106 ... 115 116 117 118 119 120
R   e        (x, y) int64 101 102 103 104 105 106 ... 123 124 125 126 127 128
L   c        (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
R   c        (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
L   a        (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>
R   a        (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>
obj = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...64 1 1 1 1
    e        (x, y) int64 100 101 102 103 104 105 ... 123 124 125 126 127 128
Attributes:
    test:     test

    @pytest.mark.parametrize("obj", [make_da(), make_ds()])
    def test_map_blocks_da_ds_with_template(obj):
        func = lambda x: x.isel(x=[1])
        template = obj.isel(x=[1, 5, 9])
        with raise_if_dask_computes():
            actual = xr.map_blocks(func, obj, template=template)
>       assert_identical(actual, template)
E       AssertionError: Left and right Dataset objects are not identical
E       Differing dimensions:
E           (x: 1, y: 20, z: 4) != (x: 3, y: 20, z: 4)
E       Differing coordinates:
E       L   ndcoord  (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
E       R   ndcoord  (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
E       L   xx       (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>
E       R   xx       (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>
E       L   cxy      (x, y) int64 dask.array<chunksize=(1, 5), meta=np.ndarray>
E       R   cxy      (x, y) int64 dask.array<chunksize=(1, 5), meta=np.ndarray>
E       L * x        (x) int64 1
E       R * x        (x) int64 1 5 9
E       L   cx       (x) int64 1
E       R   cx       (x) int64 1 5 9
E       Differing data variables:
E       L   b        (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>
E       R   b        (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>
E       L   e        (x, y) int64 101 102 103 104 105 106 ... 115 116 117 118 119 120
E       R   e        (x, y) int64 101 102 103 104 105 106 ... 123 124 125 126 127 128
E       L   c        (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
E       R   c        (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
E       L   a        (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>
E       R   a        (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>

/home/runner/work/xarray/xarray/xarray/tests/test_dask.py:1371: AssertionError

Check warning on line 0 in xarray.tests.test_dask

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 10 runs failed: test_map_blocks_template_convert_object (xarray.tests.test_dask)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
AssertionError: Left and right Dataset objects are not identical
Differing dimensions:
    (x: 1, y: 20) != (x: 3, y: 20)
Differing coordinates:
L   ndcoord  (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
R   ndcoord  (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
L   cxy      (x, y) int64 dask.array<chunksize=(1, 5), meta=np.ndarray>
R   cxy      (x, y) int64 dask.array<chunksize=(1, 5), meta=np.ndarray>
L * x        (x) int64 1
R * x        (x) int64 1 5 9
Differing data variables:
L   a        (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>
R   a        (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>
def test_map_blocks_template_convert_object():
        da = make_da()
        func = lambda x: x.to_dataset().isel(x=[1])
        template = da.to_dataset().isel(x=[1, 5, 9])
        with raise_if_dask_computes():
            actual = xr.map_blocks(func, da, template=template)
>       assert_identical(actual, template)
E       AssertionError: Left and right Dataset objects are not identical
E       Differing dimensions:
E           (x: 1, y: 20) != (x: 3, y: 20)
E       Differing coordinates:
E       L   ndcoord  (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
E       R   ndcoord  (x) int64 dask.array<chunksize=(1,), meta=np.ndarray>
E       L   cxy      (x, y) int64 dask.array<chunksize=(1, 5), meta=np.ndarray>
E       R   cxy      (x, y) int64 dask.array<chunksize=(1, 5), meta=np.ndarray>
E       L * x        (x) int64 1
E       R * x        (x) int64 1 5 9
E       Differing data variables:
E       L   a        (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>
E       R   a        (x, y) float64 dask.array<chunksize=(1, 5), meta=np.ndarray>

/home/runner/work/xarray/xarray/xarray/tests/test_dask.py:1403: AssertionError

Check warning on line 0 in xarray.tests.test_dask

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 10 runs failed: test_map_blocks_errors_bad_template[obj0] (xarray.tests.test_dask)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
Failed: DID NOT RAISE <class 'ValueError'>
obj = <xarray.DataArray 'a' (x: 10, y: 20)>
dask.array<xarray-<this-array>, shape=(10, 20), dtype=float64, chunksize=(4, 5),...meta=np.ndarray>
    cxy      (x, y) int64 dask.array<chunksize=(4, 5), meta=np.ndarray>
Attributes:
    test:     test

    @pytest.mark.parametrize("obj", [make_da(), make_ds()])
    def test_map_blocks_errors_bad_template(obj):
        with pytest.raises(ValueError, match=r"unexpected coordinate variables"):
>           xr.map_blocks(lambda x: x.assign_coords(a=10), obj, template=obj).compute()
E           Failed: DID NOT RAISE <class 'ValueError'>

/home/runner/work/xarray/xarray/xarray/tests/test_dask.py:1416: Failed

Check warning on line 0 in xarray.tests.test_dask

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 10 runs failed: test_map_blocks_errors_bad_template[obj1] (xarray.tests.test_dask)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
Failed: DID NOT RAISE <class 'ValueError'>
obj = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...64 1 1 1 1
    e        (x, y) int64 100 101 102 103 104 105 ... 123 124 125 126 127 128
Attributes:
    test:     test

    @pytest.mark.parametrize("obj", [make_da(), make_ds()])
    def test_map_blocks_errors_bad_template(obj):
        with pytest.raises(ValueError, match=r"unexpected coordinate variables"):
>           xr.map_blocks(lambda x: x.assign_coords(a=10), obj, template=obj).compute()
E           Failed: DID NOT RAISE <class 'ValueError'>

/home/runner/work/xarray/xarray/xarray/tests/test_dask.py:1416: Failed

Check warning on line 0 in xarray.tests.test_dask

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 10 runs failed: test_map_blocks_errors_bad_template_2 (xarray.tests.test_dask)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
Failed: DID NOT RAISE <class 'ValueError'>
map_ds = <xarray.Dataset>
Dimensions:  (x: 10, y: 20, z: 4)
Coordinates:
  * x        (x) int64 0 1 2 3 4 5 6 7 8 9
  * y      ...64 1 1 1 1
    e        (x, y) int64 100 101 102 103 104 105 ... 123 124 125 126 127 128
Attributes:
    test:     test

    def test_map_blocks_errors_bad_template_2(map_ds):
        with pytest.raises(ValueError, match=r"unexpected data variables {'xyz'}"):
>           xr.map_blocks(lambda x: x.assign(xyz=1), map_ds, template=map_ds).compute()
E           Failed: DID NOT RAISE <class 'ValueError'>

/home/runner/work/xarray/xarray/xarray/tests/test_dask.py:1439: Failed

Check warning on line 0 in xarray.tests.test_units

See this annotation in the file changed.

@github-actions github-actions / Test Results

7 out of 8 runs failed: test_broadcast_dataset[float64] (xarray.tests.test_units)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
TypeError: object of type 'NoneType' has no len()
dtype = dtype('float64')

    def test_broadcast_dataset(dtype):
        # uses align internally so more thorough tests are not needed
        array1 = np.linspace(0, 10, 2) * unit_registry.Pa
        array2 = np.linspace(0, 10, 3) * unit_registry.Pa
    
        x1 = np.arange(2)
        y1 = np.arange(3)
    
        x2 = np.arange(2, 4)
        y2 = np.arange(3, 6)
    
        ds = xr.Dataset(
            data_vars={"a": ("x", array1), "b": ("y", array2)}, coords={"x": x1, "y": y1}
        )
        other = xr.Dataset(
            data_vars={
                "a": ("x", array1.to(unit_registry.hPa)),
                "b": ("y", array2.to(unit_registry.hPa)),
            },
            coords={"x": x2, "y": y2},
        )
    
        units_a = extract_units(ds)
        units_b = extract_units(other)
        expected_a, expected_b = xr.broadcast(strip_units(ds), strip_units(other))
        expected_a = attach_units(expected_a, units_a)
        expected_b = attach_units(expected_b, units_b)
    
>       actual_a, actual_b = xr.broadcast(ds, other)

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:710: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/core/alignment.py:1225: in broadcast
    args = align(*args, join="outer", copy=False, exclude=exclude)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:889: in align
    aligner.align()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:583: in align
    self.reindex_all()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:558: in reindex_all
    self.results = tuple(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:559: in <genexpr>
    self._reindex_one(obj, matching_indexes)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:547: in _reindex_one
    return obj._reindex_callback(
/home/runner/work/xarray/xarray/xarray/core/dataset.py:3451: in _reindex_callback
    reindexed_vars = alignment.reindex_variables(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:80: in reindex_variables
    new_var = var._getitem_with_mask(indxr, fill_value=fill_value_)
/home/runner/work/xarray/xarray/xarray/core/variable.py:795: in _getitem_with_mask
    mask = indexing.create_mask(indexer, self.shape, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1208: in create_mask
    mask = _masked_result_drop_slice(key, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1170: in _masked_result_drop_slice
    _chunked_array_with_chunks_hint(k, chunks_hint, chunkmanager)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

array = array([ 0,  1, -1, -1]), chunks = None
chunkmanager = <xarray.namedarray.daskmanager.DaskManager object at 0x7f41c5b6f400>

    def _chunked_array_with_chunks_hint(array, chunks, chunkmanager):
        """Create a chunked array using the chunks hint for dimensions of size > 1."""
    
>       if len(chunks) < array.ndim:
E       TypeError: object of type 'NoneType' has no len()

/home/runner/work/xarray/xarray/xarray/core/indexing.py:1148: TypeError

Check warning on line 0 in xarray.tests.test_units

See this annotation in the file changed.

@github-actions github-actions / Test Results

5 out of 6 runs failed: test_broadcast_dataset[int64] (xarray.tests.test_units)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
TypeError: object of type 'NoneType' has no len()
dtype = dtype('int64')

    def test_broadcast_dataset(dtype):
        # uses align internally so more thorough tests are not needed
        array1 = np.linspace(0, 10, 2) * unit_registry.Pa
        array2 = np.linspace(0, 10, 3) * unit_registry.Pa
    
        x1 = np.arange(2)
        y1 = np.arange(3)
    
        x2 = np.arange(2, 4)
        y2 = np.arange(3, 6)
    
        ds = xr.Dataset(
            data_vars={"a": ("x", array1), "b": ("y", array2)}, coords={"x": x1, "y": y1}
        )
        other = xr.Dataset(
            data_vars={
                "a": ("x", array1.to(unit_registry.hPa)),
                "b": ("y", array2.to(unit_registry.hPa)),
            },
            coords={"x": x2, "y": y2},
        )
    
        units_a = extract_units(ds)
        units_b = extract_units(other)
        expected_a, expected_b = xr.broadcast(strip_units(ds), strip_units(other))
        expected_a = attach_units(expected_a, units_a)
        expected_b = attach_units(expected_b, units_b)
    
>       actual_a, actual_b = xr.broadcast(ds, other)

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:710: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/core/alignment.py:1225: in broadcast
    args = align(*args, join="outer", copy=False, exclude=exclude)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:889: in align
    aligner.align()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:583: in align
    self.reindex_all()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:558: in reindex_all
    self.results = tuple(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:559: in <genexpr>
    self._reindex_one(obj, matching_indexes)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:547: in _reindex_one
    return obj._reindex_callback(
/home/runner/work/xarray/xarray/xarray/core/dataset.py:3451: in _reindex_callback
    reindexed_vars = alignment.reindex_variables(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:80: in reindex_variables
    new_var = var._getitem_with_mask(indxr, fill_value=fill_value_)
/home/runner/work/xarray/xarray/xarray/core/variable.py:795: in _getitem_with_mask
    mask = indexing.create_mask(indexer, self.shape, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1208: in create_mask
    mask = _masked_result_drop_slice(key, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1170: in _masked_result_drop_slice
    _chunked_array_with_chunks_hint(k, chunks_hint, chunkmanager)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

array = array([ 0,  1, -1, -1]), chunks = None
chunkmanager = <xarray.namedarray.daskmanager.DaskManager object at 0x7f41c5b6f400>

    def _chunked_array_with_chunks_hint(array, chunks, chunkmanager):
        """Create a chunked array using the chunks hint for dimensions of size > 1."""
    
>       if len(chunks) < array.ndim:
E       TypeError: object of type 'NoneType' has no len()

/home/runner/work/xarray/xarray/xarray/core/indexing.py:1148: TypeError

Check warning on line 0 in xarray.tests.test_units

See this annotation in the file changed.

@github-actions github-actions / Test Results

7 out of 8 runs failed: test_combine_nested[float64-data-no_unit] (xarray.tests.test_units)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
TypeError: object of type 'NoneType' has no len()
variant = 'data', unit = 1, error = <class 'pint.errors.DimensionalityError'>
dtype = dtype('float64')

    @pytest.mark.parametrize(
        "unit,error",
        (
            pytest.param(1, DimensionalityError, id="no_unit"),
            pytest.param(
                unit_registry.dimensionless, DimensionalityError, id="dimensionless"
            ),
            pytest.param(unit_registry.s, DimensionalityError, id="incompatible_unit"),
            pytest.param(unit_registry.mm, None, id="compatible_unit"),
            pytest.param(unit_registry.m, None, id="identical_unit"),
        ),
        ids=repr,
    )
    @pytest.mark.parametrize(
        "variant",
        (
            "data",
            pytest.param(
                "dims", marks=pytest.mark.skip(reason="indexes don't support units")
            ),
            "coords",
        ),
    )
    def test_combine_nested(variant, unit, error, dtype):
        original_unit = unit_registry.m
    
        variants = {
            "data": ((original_unit, unit), (1, 1), (1, 1)),
            "dims": ((1, 1), (original_unit, unit), (1, 1)),
            "coords": ((1, 1), (1, 1), (original_unit, unit)),
        }
        (
            (data_unit1, data_unit2),
            (dim_unit1, dim_unit2),
            (coord_unit1, coord_unit2),
        ) = variants.get(variant)
    
        array1 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1
        array2 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1
    
        x = np.arange(1, 4) * 10 * dim_unit1
        y = np.arange(2) * dim_unit1
        z = np.arange(3) * coord_unit1
    
        ds1 = xr.Dataset(
            data_vars={"a": (("y", "x"), array1), "b": (("y", "x"), array2)},
            coords={"x": x, "y": y, "z": ("x", z)},
        )
        ds2 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), np.ones_like(array1) * data_unit2),
                "b": (("y", "x"), np.ones_like(array2) * data_unit2),
            },
            coords={
                "x": np.arange(3) * dim_unit2,
                "y": np.arange(2, 4) * dim_unit2,
                "z": ("x", np.arange(-3, 0) * coord_unit2),
            },
        )
        ds3 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), np.full_like(array1, fill_value=np.nan) * data_unit2),
                "b": (("y", "x"), np.full_like(array2, fill_value=np.nan) * data_unit2),
            },
            coords={
                "x": np.arange(3, 6) * dim_unit2,
                "y": np.arange(4, 6) * dim_unit2,
                "z": ("x", np.arange(3, 6) * coord_unit2),
            },
        )
        ds4 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), -1 * np.ones_like(array1) * data_unit2),
                "b": (("y", "x"), -1 * np.ones_like(array2) * data_unit2),
            },
            coords={
                "x": np.arange(6, 9) * dim_unit2,
                "y": np.arange(6, 8) * dim_unit2,
                "z": ("x", np.arange(6, 9) * coord_unit2),
            },
        )
    
        func = function(xr.combine_nested, concat_dim=["x", "y"])
        if error is not None:
            with pytest.raises(error):
>               func([[ds1, ds2], [ds3, ds4]])

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:880: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:371: in __call__
    return self.func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/core/combine.py:577: in combine_nested
    return _nested_combine(
/home/runner/work/xarray/xarray/xarray/core/combine.py:356: in _nested_combine
    combined = _combine_nd(
/home/runner/work/xarray/xarray/xarray/core/combine.py:232: in _combine_nd
    combined_ids = _combine_all_along_first_dim(
/home/runner/work/xarray/xarray/xarray/core/combine.py:267: in _combine_all_along_first_dim
    new_combined_ids[new_id] = _combine_1d(
/home/runner/work/xarray/xarray/xarray/core/combine.py:290: in _combine_1d
    combined = concat(
/home/runner/work/xarray/xarray/xarray/core/concat.py:252: in concat
    return _dataset_concat(
/home/runner/work/xarray/xarray/xarray/core/concat.py:487: in _dataset_concat
    align(*datasets, join=join, copy=False, exclude=[dim], fill_value=fill_value)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:889: in align
    aligner.align()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:583: in align
    self.reindex_all()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:558: in reindex_all
    self.results = tuple(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:559: in <genexpr>
    self._reindex_one(obj, matching_indexes)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:547: in _reindex_one
    return obj._reindex_callback(
/home/runner/work/xarray/xarray/xarray/core/dataset.py:3451: in _reindex_callback
    reindexed_vars = alignment.reindex_variables(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:80: in reindex_variables
    new_var = var._getitem_with_mask(indxr, fill_value=fill_value_)
/home/runner/work/xarray/xarray/xarray/core/variable.py:795: in _getitem_with_mask
    mask = indexing.create_mask(indexer, self.shape, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1208: in create_mask
    mask = _masked_result_drop_slice(key, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1170: in _masked_result_drop_slice
    _chunked_array_with_chunks_hint(k, chunks_hint, chunkmanager)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

array = array([[ 0],
       [ 1],
       [-1],
       [-1]]), chunks = None
chunkmanager = <xarray.namedarray.daskmanager.DaskManager object at 0x7f41c5b6f400>

    def _chunked_array_with_chunks_hint(array, chunks, chunkmanager):
        """Create a chunked array using the chunks hint for dimensions of size > 1."""
    
>       if len(chunks) < array.ndim:
E       TypeError: object of type 'NoneType' has no len()

/home/runner/work/xarray/xarray/xarray/core/indexing.py:1148: TypeError

Check warning on line 0 in xarray.tests.test_units

See this annotation in the file changed.

@github-actions github-actions / Test Results

7 out of 8 runs failed: test_combine_nested[float64-data-dimensionless] (xarray.tests.test_units)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
TypeError: object of type 'NoneType' has no len()
variant = 'data', unit = <Unit('dimensionless')>
error = <class 'pint.errors.DimensionalityError'>, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "unit,error",
        (
            pytest.param(1, DimensionalityError, id="no_unit"),
            pytest.param(
                unit_registry.dimensionless, DimensionalityError, id="dimensionless"
            ),
            pytest.param(unit_registry.s, DimensionalityError, id="incompatible_unit"),
            pytest.param(unit_registry.mm, None, id="compatible_unit"),
            pytest.param(unit_registry.m, None, id="identical_unit"),
        ),
        ids=repr,
    )
    @pytest.mark.parametrize(
        "variant",
        (
            "data",
            pytest.param(
                "dims", marks=pytest.mark.skip(reason="indexes don't support units")
            ),
            "coords",
        ),
    )
    def test_combine_nested(variant, unit, error, dtype):
        original_unit = unit_registry.m
    
        variants = {
            "data": ((original_unit, unit), (1, 1), (1, 1)),
            "dims": ((1, 1), (original_unit, unit), (1, 1)),
            "coords": ((1, 1), (1, 1), (original_unit, unit)),
        }
        (
            (data_unit1, data_unit2),
            (dim_unit1, dim_unit2),
            (coord_unit1, coord_unit2),
        ) = variants.get(variant)
    
        array1 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1
        array2 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1
    
        x = np.arange(1, 4) * 10 * dim_unit1
        y = np.arange(2) * dim_unit1
        z = np.arange(3) * coord_unit1
    
        ds1 = xr.Dataset(
            data_vars={"a": (("y", "x"), array1), "b": (("y", "x"), array2)},
            coords={"x": x, "y": y, "z": ("x", z)},
        )
        ds2 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), np.ones_like(array1) * data_unit2),
                "b": (("y", "x"), np.ones_like(array2) * data_unit2),
            },
            coords={
                "x": np.arange(3) * dim_unit2,
                "y": np.arange(2, 4) * dim_unit2,
                "z": ("x", np.arange(-3, 0) * coord_unit2),
            },
        )
        ds3 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), np.full_like(array1, fill_value=np.nan) * data_unit2),
                "b": (("y", "x"), np.full_like(array2, fill_value=np.nan) * data_unit2),
            },
            coords={
                "x": np.arange(3, 6) * dim_unit2,
                "y": np.arange(4, 6) * dim_unit2,
                "z": ("x", np.arange(3, 6) * coord_unit2),
            },
        )
        ds4 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), -1 * np.ones_like(array1) * data_unit2),
                "b": (("y", "x"), -1 * np.ones_like(array2) * data_unit2),
            },
            coords={
                "x": np.arange(6, 9) * dim_unit2,
                "y": np.arange(6, 8) * dim_unit2,
                "z": ("x", np.arange(6, 9) * coord_unit2),
            },
        )
    
        func = function(xr.combine_nested, concat_dim=["x", "y"])
        if error is not None:
            with pytest.raises(error):
>               func([[ds1, ds2], [ds3, ds4]])

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:880: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:371: in __call__
    return self.func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/core/combine.py:577: in combine_nested
    return _nested_combine(
/home/runner/work/xarray/xarray/xarray/core/combine.py:356: in _nested_combine
    combined = _combine_nd(
/home/runner/work/xarray/xarray/xarray/core/combine.py:232: in _combine_nd
    combined_ids = _combine_all_along_first_dim(
/home/runner/work/xarray/xarray/xarray/core/combine.py:267: in _combine_all_along_first_dim
    new_combined_ids[new_id] = _combine_1d(
/home/runner/work/xarray/xarray/xarray/core/combine.py:290: in _combine_1d
    combined = concat(
/home/runner/work/xarray/xarray/xarray/core/concat.py:252: in concat
    return _dataset_concat(
/home/runner/work/xarray/xarray/xarray/core/concat.py:487: in _dataset_concat
    align(*datasets, join=join, copy=False, exclude=[dim], fill_value=fill_value)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:889: in align
    aligner.align()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:583: in align
    self.reindex_all()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:558: in reindex_all
    self.results = tuple(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:559: in <genexpr>
    self._reindex_one(obj, matching_indexes)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:547: in _reindex_one
    return obj._reindex_callback(
/home/runner/work/xarray/xarray/xarray/core/dataset.py:3451: in _reindex_callback
    reindexed_vars = alignment.reindex_variables(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:80: in reindex_variables
    new_var = var._getitem_with_mask(indxr, fill_value=fill_value_)
/home/runner/work/xarray/xarray/xarray/core/variable.py:795: in _getitem_with_mask
    mask = indexing.create_mask(indexer, self.shape, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1208: in create_mask
    mask = _masked_result_drop_slice(key, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1170: in _masked_result_drop_slice
    _chunked_array_with_chunks_hint(k, chunks_hint, chunkmanager)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

array = array([[ 0],
       [ 1],
       [-1],
       [-1]]), chunks = None
chunkmanager = <xarray.namedarray.daskmanager.DaskManager object at 0x7f41c5b6f400>

    def _chunked_array_with_chunks_hint(array, chunks, chunkmanager):
        """Create a chunked array using the chunks hint for dimensions of size > 1."""
    
>       if len(chunks) < array.ndim:
E       TypeError: object of type 'NoneType' has no len()

/home/runner/work/xarray/xarray/xarray/core/indexing.py:1148: TypeError

Check warning on line 0 in xarray.tests.test_units

See this annotation in the file changed.

@github-actions github-actions / Test Results

7 out of 8 runs failed: test_combine_nested[float64-data-incompatible_unit] (xarray.tests.test_units)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
TypeError: object of type 'NoneType' has no len()
variant = 'data', unit = <Unit('second')>
error = <class 'pint.errors.DimensionalityError'>, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "unit,error",
        (
            pytest.param(1, DimensionalityError, id="no_unit"),
            pytest.param(
                unit_registry.dimensionless, DimensionalityError, id="dimensionless"
            ),
            pytest.param(unit_registry.s, DimensionalityError, id="incompatible_unit"),
            pytest.param(unit_registry.mm, None, id="compatible_unit"),
            pytest.param(unit_registry.m, None, id="identical_unit"),
        ),
        ids=repr,
    )
    @pytest.mark.parametrize(
        "variant",
        (
            "data",
            pytest.param(
                "dims", marks=pytest.mark.skip(reason="indexes don't support units")
            ),
            "coords",
        ),
    )
    def test_combine_nested(variant, unit, error, dtype):
        original_unit = unit_registry.m
    
        variants = {
            "data": ((original_unit, unit), (1, 1), (1, 1)),
            "dims": ((1, 1), (original_unit, unit), (1, 1)),
            "coords": ((1, 1), (1, 1), (original_unit, unit)),
        }
        (
            (data_unit1, data_unit2),
            (dim_unit1, dim_unit2),
            (coord_unit1, coord_unit2),
        ) = variants.get(variant)
    
        array1 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1
        array2 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1
    
        x = np.arange(1, 4) * 10 * dim_unit1
        y = np.arange(2) * dim_unit1
        z = np.arange(3) * coord_unit1
    
        ds1 = xr.Dataset(
            data_vars={"a": (("y", "x"), array1), "b": (("y", "x"), array2)},
            coords={"x": x, "y": y, "z": ("x", z)},
        )
        ds2 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), np.ones_like(array1) * data_unit2),
                "b": (("y", "x"), np.ones_like(array2) * data_unit2),
            },
            coords={
                "x": np.arange(3) * dim_unit2,
                "y": np.arange(2, 4) * dim_unit2,
                "z": ("x", np.arange(-3, 0) * coord_unit2),
            },
        )
        ds3 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), np.full_like(array1, fill_value=np.nan) * data_unit2),
                "b": (("y", "x"), np.full_like(array2, fill_value=np.nan) * data_unit2),
            },
            coords={
                "x": np.arange(3, 6) * dim_unit2,
                "y": np.arange(4, 6) * dim_unit2,
                "z": ("x", np.arange(3, 6) * coord_unit2),
            },
        )
        ds4 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), -1 * np.ones_like(array1) * data_unit2),
                "b": (("y", "x"), -1 * np.ones_like(array2) * data_unit2),
            },
            coords={
                "x": np.arange(6, 9) * dim_unit2,
                "y": np.arange(6, 8) * dim_unit2,
                "z": ("x", np.arange(6, 9) * coord_unit2),
            },
        )
    
        func = function(xr.combine_nested, concat_dim=["x", "y"])
        if error is not None:
            with pytest.raises(error):
>               func([[ds1, ds2], [ds3, ds4]])

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:880: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:371: in __call__
    return self.func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/core/combine.py:577: in combine_nested
    return _nested_combine(
/home/runner/work/xarray/xarray/xarray/core/combine.py:356: in _nested_combine
    combined = _combine_nd(
/home/runner/work/xarray/xarray/xarray/core/combine.py:232: in _combine_nd
    combined_ids = _combine_all_along_first_dim(
/home/runner/work/xarray/xarray/xarray/core/combine.py:267: in _combine_all_along_first_dim
    new_combined_ids[new_id] = _combine_1d(
/home/runner/work/xarray/xarray/xarray/core/combine.py:290: in _combine_1d
    combined = concat(
/home/runner/work/xarray/xarray/xarray/core/concat.py:252: in concat
    return _dataset_concat(
/home/runner/work/xarray/xarray/xarray/core/concat.py:487: in _dataset_concat
    align(*datasets, join=join, copy=False, exclude=[dim], fill_value=fill_value)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:889: in align
    aligner.align()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:583: in align
    self.reindex_all()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:558: in reindex_all
    self.results = tuple(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:559: in <genexpr>
    self._reindex_one(obj, matching_indexes)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:547: in _reindex_one
    return obj._reindex_callback(
/home/runner/work/xarray/xarray/xarray/core/dataset.py:3451: in _reindex_callback
    reindexed_vars = alignment.reindex_variables(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:80: in reindex_variables
    new_var = var._getitem_with_mask(indxr, fill_value=fill_value_)
/home/runner/work/xarray/xarray/xarray/core/variable.py:795: in _getitem_with_mask
    mask = indexing.create_mask(indexer, self.shape, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1208: in create_mask
    mask = _masked_result_drop_slice(key, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1170: in _masked_result_drop_slice
    _chunked_array_with_chunks_hint(k, chunks_hint, chunkmanager)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

array = array([[ 0],
       [ 1],
       [-1],
       [-1]]), chunks = None
chunkmanager = <xarray.namedarray.daskmanager.DaskManager object at 0x7f41c5b6f400>

    def _chunked_array_with_chunks_hint(array, chunks, chunkmanager):
        """Create a chunked array using the chunks hint for dimensions of size > 1."""
    
>       if len(chunks) < array.ndim:
E       TypeError: object of type 'NoneType' has no len()

/home/runner/work/xarray/xarray/xarray/core/indexing.py:1148: TypeError

Check warning on line 0 in xarray.tests.test_units

See this annotation in the file changed.

@github-actions github-actions / Test Results

7 out of 8 runs failed: test_combine_nested[float64-data-compatible_unit] (xarray.tests.test_units)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
TypeError: object of type 'NoneType' has no len()
variant = 'data', unit = <Unit('millimeter')>, error = None
dtype = dtype('float64')

    @pytest.mark.parametrize(
        "unit,error",
        (
            pytest.param(1, DimensionalityError, id="no_unit"),
            pytest.param(
                unit_registry.dimensionless, DimensionalityError, id="dimensionless"
            ),
            pytest.param(unit_registry.s, DimensionalityError, id="incompatible_unit"),
            pytest.param(unit_registry.mm, None, id="compatible_unit"),
            pytest.param(unit_registry.m, None, id="identical_unit"),
        ),
        ids=repr,
    )
    @pytest.mark.parametrize(
        "variant",
        (
            "data",
            pytest.param(
                "dims", marks=pytest.mark.skip(reason="indexes don't support units")
            ),
            "coords",
        ),
    )
    def test_combine_nested(variant, unit, error, dtype):
        original_unit = unit_registry.m
    
        variants = {
            "data": ((original_unit, unit), (1, 1), (1, 1)),
            "dims": ((1, 1), (original_unit, unit), (1, 1)),
            "coords": ((1, 1), (1, 1), (original_unit, unit)),
        }
        (
            (data_unit1, data_unit2),
            (dim_unit1, dim_unit2),
            (coord_unit1, coord_unit2),
        ) = variants.get(variant)
    
        array1 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1
        array2 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1
    
        x = np.arange(1, 4) * 10 * dim_unit1
        y = np.arange(2) * dim_unit1
        z = np.arange(3) * coord_unit1
    
        ds1 = xr.Dataset(
            data_vars={"a": (("y", "x"), array1), "b": (("y", "x"), array2)},
            coords={"x": x, "y": y, "z": ("x", z)},
        )
        ds2 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), np.ones_like(array1) * data_unit2),
                "b": (("y", "x"), np.ones_like(array2) * data_unit2),
            },
            coords={
                "x": np.arange(3) * dim_unit2,
                "y": np.arange(2, 4) * dim_unit2,
                "z": ("x", np.arange(-3, 0) * coord_unit2),
            },
        )
        ds3 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), np.full_like(array1, fill_value=np.nan) * data_unit2),
                "b": (("y", "x"), np.full_like(array2, fill_value=np.nan) * data_unit2),
            },
            coords={
                "x": np.arange(3, 6) * dim_unit2,
                "y": np.arange(4, 6) * dim_unit2,
                "z": ("x", np.arange(3, 6) * coord_unit2),
            },
        )
        ds4 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), -1 * np.ones_like(array1) * data_unit2),
                "b": (("y", "x"), -1 * np.ones_like(array2) * data_unit2),
            },
            coords={
                "x": np.arange(6, 9) * dim_unit2,
                "y": np.arange(6, 8) * dim_unit2,
                "z": ("x", np.arange(6, 9) * coord_unit2),
            },
        )
    
        func = function(xr.combine_nested, concat_dim=["x", "y"])
        if error is not None:
            with pytest.raises(error):
                func([[ds1, ds2], [ds3, ds4]])
    
            return
    
        units = extract_units(ds1)
        convert_and_strip = lambda ds: strip_units(convert_units(ds, units))
        expected = attach_units(
            func(
                [
                    [strip_units(ds1), convert_and_strip(ds2)],
                    [convert_and_strip(ds3), convert_and_strip(ds4)],
                ]
            ),
            units,
        )
>       actual = func([[ds1, ds2], [ds3, ds4]])

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:895: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:371: in __call__
    return self.func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/core/combine.py:577: in combine_nested
    return _nested_combine(
/home/runner/work/xarray/xarray/xarray/core/combine.py:356: in _nested_combine
    combined = _combine_nd(
/home/runner/work/xarray/xarray/xarray/core/combine.py:232: in _combine_nd
    combined_ids = _combine_all_along_first_dim(
/home/runner/work/xarray/xarray/xarray/core/combine.py:267: in _combine_all_along_first_dim
    new_combined_ids[new_id] = _combine_1d(
/home/runner/work/xarray/xarray/xarray/core/combine.py:290: in _combine_1d
    combined = concat(
/home/runner/work/xarray/xarray/xarray/core/concat.py:252: in concat
    return _dataset_concat(
/home/runner/work/xarray/xarray/xarray/core/concat.py:487: in _dataset_concat
    align(*datasets, join=join, copy=False, exclude=[dim], fill_value=fill_value)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:889: in align
    aligner.align()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:583: in align
    self.reindex_all()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:558: in reindex_all
    self.results = tuple(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:559: in <genexpr>
    self._reindex_one(obj, matching_indexes)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:547: in _reindex_one
    return obj._reindex_callback(
/home/runner/work/xarray/xarray/xarray/core/dataset.py:3451: in _reindex_callback
    reindexed_vars = alignment.reindex_variables(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:80: in reindex_variables
    new_var = var._getitem_with_mask(indxr, fill_value=fill_value_)
/home/runner/work/xarray/xarray/xarray/core/variable.py:795: in _getitem_with_mask
    mask = indexing.create_mask(indexer, self.shape, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1208: in create_mask
    mask = _masked_result_drop_slice(key, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1170: in _masked_result_drop_slice
    _chunked_array_with_chunks_hint(k, chunks_hint, chunkmanager)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

array = array([[ 0],
       [ 1],
       [-1],
       [-1]]), chunks = None
chunkmanager = <xarray.namedarray.daskmanager.DaskManager object at 0x7f41c5b6f400>

    def _chunked_array_with_chunks_hint(array, chunks, chunkmanager):
        """Create a chunked array using the chunks hint for dimensions of size > 1."""
    
>       if len(chunks) < array.ndim:
E       TypeError: object of type 'NoneType' has no len()

/home/runner/work/xarray/xarray/xarray/core/indexing.py:1148: TypeError

Check warning on line 0 in xarray.tests.test_units

See this annotation in the file changed.

@github-actions github-actions / Test Results

7 out of 8 runs failed: test_combine_nested[float64-data-identical_unit] (xarray.tests.test_units)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
TypeError: object of type 'NoneType' has no len()
variant = 'data', unit = <Unit('meter')>, error = None, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "unit,error",
        (
            pytest.param(1, DimensionalityError, id="no_unit"),
            pytest.param(
                unit_registry.dimensionless, DimensionalityError, id="dimensionless"
            ),
            pytest.param(unit_registry.s, DimensionalityError, id="incompatible_unit"),
            pytest.param(unit_registry.mm, None, id="compatible_unit"),
            pytest.param(unit_registry.m, None, id="identical_unit"),
        ),
        ids=repr,
    )
    @pytest.mark.parametrize(
        "variant",
        (
            "data",
            pytest.param(
                "dims", marks=pytest.mark.skip(reason="indexes don't support units")
            ),
            "coords",
        ),
    )
    def test_combine_nested(variant, unit, error, dtype):
        original_unit = unit_registry.m
    
        variants = {
            "data": ((original_unit, unit), (1, 1), (1, 1)),
            "dims": ((1, 1), (original_unit, unit), (1, 1)),
            "coords": ((1, 1), (1, 1), (original_unit, unit)),
        }
        (
            (data_unit1, data_unit2),
            (dim_unit1, dim_unit2),
            (coord_unit1, coord_unit2),
        ) = variants.get(variant)
    
        array1 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1
        array2 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1
    
        x = np.arange(1, 4) * 10 * dim_unit1
        y = np.arange(2) * dim_unit1
        z = np.arange(3) * coord_unit1
    
        ds1 = xr.Dataset(
            data_vars={"a": (("y", "x"), array1), "b": (("y", "x"), array2)},
            coords={"x": x, "y": y, "z": ("x", z)},
        )
        ds2 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), np.ones_like(array1) * data_unit2),
                "b": (("y", "x"), np.ones_like(array2) * data_unit2),
            },
            coords={
                "x": np.arange(3) * dim_unit2,
                "y": np.arange(2, 4) * dim_unit2,
                "z": ("x", np.arange(-3, 0) * coord_unit2),
            },
        )
        ds3 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), np.full_like(array1, fill_value=np.nan) * data_unit2),
                "b": (("y", "x"), np.full_like(array2, fill_value=np.nan) * data_unit2),
            },
            coords={
                "x": np.arange(3, 6) * dim_unit2,
                "y": np.arange(4, 6) * dim_unit2,
                "z": ("x", np.arange(3, 6) * coord_unit2),
            },
        )
        ds4 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), -1 * np.ones_like(array1) * data_unit2),
                "b": (("y", "x"), -1 * np.ones_like(array2) * data_unit2),
            },
            coords={
                "x": np.arange(6, 9) * dim_unit2,
                "y": np.arange(6, 8) * dim_unit2,
                "z": ("x", np.arange(6, 9) * coord_unit2),
            },
        )
    
        func = function(xr.combine_nested, concat_dim=["x", "y"])
        if error is not None:
            with pytest.raises(error):
                func([[ds1, ds2], [ds3, ds4]])
    
            return
    
        units = extract_units(ds1)
        convert_and_strip = lambda ds: strip_units(convert_units(ds, units))
        expected = attach_units(
            func(
                [
                    [strip_units(ds1), convert_and_strip(ds2)],
                    [convert_and_strip(ds3), convert_and_strip(ds4)],
                ]
            ),
            units,
        )
>       actual = func([[ds1, ds2], [ds3, ds4]])

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:895: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:371: in __call__
    return self.func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/core/combine.py:577: in combine_nested
    return _nested_combine(
/home/runner/work/xarray/xarray/xarray/core/combine.py:356: in _nested_combine
    combined = _combine_nd(
/home/runner/work/xarray/xarray/xarray/core/combine.py:232: in _combine_nd
    combined_ids = _combine_all_along_first_dim(
/home/runner/work/xarray/xarray/xarray/core/combine.py:267: in _combine_all_along_first_dim
    new_combined_ids[new_id] = _combine_1d(
/home/runner/work/xarray/xarray/xarray/core/combine.py:290: in _combine_1d
    combined = concat(
/home/runner/work/xarray/xarray/xarray/core/concat.py:252: in concat
    return _dataset_concat(
/home/runner/work/xarray/xarray/xarray/core/concat.py:487: in _dataset_concat
    align(*datasets, join=join, copy=False, exclude=[dim], fill_value=fill_value)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:889: in align
    aligner.align()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:583: in align
    self.reindex_all()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:558: in reindex_all
    self.results = tuple(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:559: in <genexpr>
    self._reindex_one(obj, matching_indexes)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:547: in _reindex_one
    return obj._reindex_callback(
/home/runner/work/xarray/xarray/xarray/core/dataset.py:3451: in _reindex_callback
    reindexed_vars = alignment.reindex_variables(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:80: in reindex_variables
    new_var = var._getitem_with_mask(indxr, fill_value=fill_value_)
/home/runner/work/xarray/xarray/xarray/core/variable.py:795: in _getitem_with_mask
    mask = indexing.create_mask(indexer, self.shape, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1208: in create_mask
    mask = _masked_result_drop_slice(key, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1170: in _masked_result_drop_slice
    _chunked_array_with_chunks_hint(k, chunks_hint, chunkmanager)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

array = array([[ 0],
       [ 1],
       [-1],
       [-1]]), chunks = None
chunkmanager = <xarray.namedarray.daskmanager.DaskManager object at 0x7f41c5b6f400>

    def _chunked_array_with_chunks_hint(array, chunks, chunkmanager):
        """Create a chunked array using the chunks hint for dimensions of size > 1."""
    
>       if len(chunks) < array.ndim:
E       TypeError: object of type 'NoneType' has no len()

/home/runner/work/xarray/xarray/xarray/core/indexing.py:1148: TypeError

Check warning on line 0 in xarray.tests.test_units

See this annotation in the file changed.

@github-actions github-actions / Test Results

7 out of 8 runs failed: test_combine_nested[float64-coords-compatible_unit] (xarray.tests.test_units)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
TypeError: object of type 'NoneType' has no len()
variant = 'coords', unit = <Unit('millimeter')>, error = None
dtype = dtype('float64')

    @pytest.mark.parametrize(
        "unit,error",
        (
            pytest.param(1, DimensionalityError, id="no_unit"),
            pytest.param(
                unit_registry.dimensionless, DimensionalityError, id="dimensionless"
            ),
            pytest.param(unit_registry.s, DimensionalityError, id="incompatible_unit"),
            pytest.param(unit_registry.mm, None, id="compatible_unit"),
            pytest.param(unit_registry.m, None, id="identical_unit"),
        ),
        ids=repr,
    )
    @pytest.mark.parametrize(
        "variant",
        (
            "data",
            pytest.param(
                "dims", marks=pytest.mark.skip(reason="indexes don't support units")
            ),
            "coords",
        ),
    )
    def test_combine_nested(variant, unit, error, dtype):
        original_unit = unit_registry.m
    
        variants = {
            "data": ((original_unit, unit), (1, 1), (1, 1)),
            "dims": ((1, 1), (original_unit, unit), (1, 1)),
            "coords": ((1, 1), (1, 1), (original_unit, unit)),
        }
        (
            (data_unit1, data_unit2),
            (dim_unit1, dim_unit2),
            (coord_unit1, coord_unit2),
        ) = variants.get(variant)
    
        array1 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1
        array2 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1
    
        x = np.arange(1, 4) * 10 * dim_unit1
        y = np.arange(2) * dim_unit1
        z = np.arange(3) * coord_unit1
    
        ds1 = xr.Dataset(
            data_vars={"a": (("y", "x"), array1), "b": (("y", "x"), array2)},
            coords={"x": x, "y": y, "z": ("x", z)},
        )
        ds2 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), np.ones_like(array1) * data_unit2),
                "b": (("y", "x"), np.ones_like(array2) * data_unit2),
            },
            coords={
                "x": np.arange(3) * dim_unit2,
                "y": np.arange(2, 4) * dim_unit2,
                "z": ("x", np.arange(-3, 0) * coord_unit2),
            },
        )
        ds3 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), np.full_like(array1, fill_value=np.nan) * data_unit2),
                "b": (("y", "x"), np.full_like(array2, fill_value=np.nan) * data_unit2),
            },
            coords={
                "x": np.arange(3, 6) * dim_unit2,
                "y": np.arange(4, 6) * dim_unit2,
                "z": ("x", np.arange(3, 6) * coord_unit2),
            },
        )
        ds4 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), -1 * np.ones_like(array1) * data_unit2),
                "b": (("y", "x"), -1 * np.ones_like(array2) * data_unit2),
            },
            coords={
                "x": np.arange(6, 9) * dim_unit2,
                "y": np.arange(6, 8) * dim_unit2,
                "z": ("x", np.arange(6, 9) * coord_unit2),
            },
        )
    
        func = function(xr.combine_nested, concat_dim=["x", "y"])
        if error is not None:
            with pytest.raises(error):
                func([[ds1, ds2], [ds3, ds4]])
    
            return
    
        units = extract_units(ds1)
        convert_and_strip = lambda ds: strip_units(convert_units(ds, units))
        expected = attach_units(
            func(
                [
                    [strip_units(ds1), convert_and_strip(ds2)],
                    [convert_and_strip(ds3), convert_and_strip(ds4)],
                ]
            ),
            units,
        )
>       actual = func([[ds1, ds2], [ds3, ds4]])

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:895: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:371: in __call__
    return self.func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/core/combine.py:577: in combine_nested
    return _nested_combine(
/home/runner/work/xarray/xarray/xarray/core/combine.py:356: in _nested_combine
    combined = _combine_nd(
/home/runner/work/xarray/xarray/xarray/core/combine.py:232: in _combine_nd
    combined_ids = _combine_all_along_first_dim(
/home/runner/work/xarray/xarray/xarray/core/combine.py:267: in _combine_all_along_first_dim
    new_combined_ids[new_id] = _combine_1d(
/home/runner/work/xarray/xarray/xarray/core/combine.py:290: in _combine_1d
    combined = concat(
/home/runner/work/xarray/xarray/xarray/core/concat.py:252: in concat
    return _dataset_concat(
/home/runner/work/xarray/xarray/xarray/core/concat.py:487: in _dataset_concat
    align(*datasets, join=join, copy=False, exclude=[dim], fill_value=fill_value)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:889: in align
    aligner.align()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:583: in align
    self.reindex_all()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:558: in reindex_all
    self.results = tuple(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:559: in <genexpr>
    self._reindex_one(obj, matching_indexes)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:547: in _reindex_one
    return obj._reindex_callback(
/home/runner/work/xarray/xarray/xarray/core/dataset.py:3451: in _reindex_callback
    reindexed_vars = alignment.reindex_variables(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:80: in reindex_variables
    new_var = var._getitem_with_mask(indxr, fill_value=fill_value_)
/home/runner/work/xarray/xarray/xarray/core/variable.py:795: in _getitem_with_mask
    mask = indexing.create_mask(indexer, self.shape, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1208: in create_mask
    mask = _masked_result_drop_slice(key, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1170: in _masked_result_drop_slice
    _chunked_array_with_chunks_hint(k, chunks_hint, chunkmanager)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

array = array([-1, -1, -1,  3,  4,  5, -1, -1, -1,  0,  1,  2]), chunks = None
chunkmanager = <xarray.namedarray.daskmanager.DaskManager object at 0x7f41c5b6f400>

    def _chunked_array_with_chunks_hint(array, chunks, chunkmanager):
        """Create a chunked array using the chunks hint for dimensions of size > 1."""
    
>       if len(chunks) < array.ndim:
E       TypeError: object of type 'NoneType' has no len()

/home/runner/work/xarray/xarray/xarray/core/indexing.py:1148: TypeError

Check warning on line 0 in xarray.tests.test_units

See this annotation in the file changed.

@github-actions github-actions / Test Results

7 out of 8 runs failed: test_combine_nested[float64-coords-identical_unit] (xarray.tests.test_units)

artifacts/Test results for Linux-3.10 flaky/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9 min-all-deps/pytest.xml [took 0s]
artifacts/Test results for Linux-3.9/pytest.xml [took 0s]
artifacts/Test results for Windows-3.11/pytest.xml [took 0s]
artifacts/Test results for Windows-3.9/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
TypeError: object of type 'NoneType' has no len()
variant = 'coords', unit = <Unit('meter')>, error = None
dtype = dtype('float64')

    @pytest.mark.parametrize(
        "unit,error",
        (
            pytest.param(1, DimensionalityError, id="no_unit"),
            pytest.param(
                unit_registry.dimensionless, DimensionalityError, id="dimensionless"
            ),
            pytest.param(unit_registry.s, DimensionalityError, id="incompatible_unit"),
            pytest.param(unit_registry.mm, None, id="compatible_unit"),
            pytest.param(unit_registry.m, None, id="identical_unit"),
        ),
        ids=repr,
    )
    @pytest.mark.parametrize(
        "variant",
        (
            "data",
            pytest.param(
                "dims", marks=pytest.mark.skip(reason="indexes don't support units")
            ),
            "coords",
        ),
    )
    def test_combine_nested(variant, unit, error, dtype):
        original_unit = unit_registry.m
    
        variants = {
            "data": ((original_unit, unit), (1, 1), (1, 1)),
            "dims": ((1, 1), (original_unit, unit), (1, 1)),
            "coords": ((1, 1), (1, 1), (original_unit, unit)),
        }
        (
            (data_unit1, data_unit2),
            (dim_unit1, dim_unit2),
            (coord_unit1, coord_unit2),
        ) = variants.get(variant)
    
        array1 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1
        array2 = np.zeros(shape=(2, 3), dtype=dtype) * data_unit1
    
        x = np.arange(1, 4) * 10 * dim_unit1
        y = np.arange(2) * dim_unit1
        z = np.arange(3) * coord_unit1
    
        ds1 = xr.Dataset(
            data_vars={"a": (("y", "x"), array1), "b": (("y", "x"), array2)},
            coords={"x": x, "y": y, "z": ("x", z)},
        )
        ds2 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), np.ones_like(array1) * data_unit2),
                "b": (("y", "x"), np.ones_like(array2) * data_unit2),
            },
            coords={
                "x": np.arange(3) * dim_unit2,
                "y": np.arange(2, 4) * dim_unit2,
                "z": ("x", np.arange(-3, 0) * coord_unit2),
            },
        )
        ds3 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), np.full_like(array1, fill_value=np.nan) * data_unit2),
                "b": (("y", "x"), np.full_like(array2, fill_value=np.nan) * data_unit2),
            },
            coords={
                "x": np.arange(3, 6) * dim_unit2,
                "y": np.arange(4, 6) * dim_unit2,
                "z": ("x", np.arange(3, 6) * coord_unit2),
            },
        )
        ds4 = xr.Dataset(
            data_vars={
                "a": (("y", "x"), -1 * np.ones_like(array1) * data_unit2),
                "b": (("y", "x"), -1 * np.ones_like(array2) * data_unit2),
            },
            coords={
                "x": np.arange(6, 9) * dim_unit2,
                "y": np.arange(6, 8) * dim_unit2,
                "z": ("x", np.arange(6, 9) * coord_unit2),
            },
        )
    
        func = function(xr.combine_nested, concat_dim=["x", "y"])
        if error is not None:
            with pytest.raises(error):
                func([[ds1, ds2], [ds3, ds4]])
    
            return
    
        units = extract_units(ds1)
        convert_and_strip = lambda ds: strip_units(convert_units(ds, units))
        expected = attach_units(
            func(
                [
                    [strip_units(ds1), convert_and_strip(ds2)],
                    [convert_and_strip(ds3), convert_and_strip(ds4)],
                ]
            ),
            units,
        )
>       actual = func([[ds1, ds2], [ds3, ds4]])

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:895: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:371: in __call__
    return self.func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/core/combine.py:577: in combine_nested
    return _nested_combine(
/home/runner/work/xarray/xarray/xarray/core/combine.py:356: in _nested_combine
    combined = _combine_nd(
/home/runner/work/xarray/xarray/xarray/core/combine.py:232: in _combine_nd
    combined_ids = _combine_all_along_first_dim(
/home/runner/work/xarray/xarray/xarray/core/combine.py:267: in _combine_all_along_first_dim
    new_combined_ids[new_id] = _combine_1d(
/home/runner/work/xarray/xarray/xarray/core/combine.py:290: in _combine_1d
    combined = concat(
/home/runner/work/xarray/xarray/xarray/core/concat.py:252: in concat
    return _dataset_concat(
/home/runner/work/xarray/xarray/xarray/core/concat.py:487: in _dataset_concat
    align(*datasets, join=join, copy=False, exclude=[dim], fill_value=fill_value)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:889: in align
    aligner.align()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:583: in align
    self.reindex_all()
/home/runner/work/xarray/xarray/xarray/core/alignment.py:558: in reindex_all
    self.results = tuple(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:559: in <genexpr>
    self._reindex_one(obj, matching_indexes)
/home/runner/work/xarray/xarray/xarray/core/alignment.py:547: in _reindex_one
    return obj._reindex_callback(
/home/runner/work/xarray/xarray/xarray/core/dataset.py:3451: in _reindex_callback
    reindexed_vars = alignment.reindex_variables(
/home/runner/work/xarray/xarray/xarray/core/alignment.py:80: in reindex_variables
    new_var = var._getitem_with_mask(indxr, fill_value=fill_value_)
/home/runner/work/xarray/xarray/xarray/core/variable.py:795: in _getitem_with_mask
    mask = indexing.create_mask(indexer, self.shape, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1208: in create_mask
    mask = _masked_result_drop_slice(key, data)
/home/runner/work/xarray/xarray/xarray/core/indexing.py:1170: in _masked_result_drop_slice
    _chunked_array_with_chunks_hint(k, chunks_hint, chunkmanager)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

array = array([-1, -1, -1,  3,  4,  5, -1, -1, -1,  0,  1,  2]), chunks = None
chunkmanager = <xarray.namedarray.daskmanager.DaskManager object at 0x7f41c5b6f400>

    def _chunked_array_with_chunks_hint(array, chunks, chunkmanager):
        """Create a chunked array using the chunks hint for dimensions of size > 1."""
    
>       if len(chunks) < array.ndim:
E       TypeError: object of type 'NoneType' has no len()

/home/runner/work/xarray/xarray/xarray/core/indexing.py:1148: TypeError