Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify get_axis_num #8330

Closed
wants to merge 3 commits into from

Merge branch 'main' into simple_axis_num

05abeb3
Select commit
Loading
Failed to load commit list.
Sign in for the full log view
Closed

Simplify get_axis_num #8330

Merge branch 'main' into simple_axis_num
05abeb3
Select commit
Loading
Failed to load commit list.
GitHub Actions / Test Results failed Oct 18, 2023 in 0s

169 fail, 2 247 skipped, 16 051 pass in 1h 16m 46s

           7 files  +         4             7 suites  +4   1h 16m 46s ⏱️ + 51m 37s
  18 467 tests +  1 145    16 051 ✔️ +     743    2 247 💤 +   397     169 +    5 
121 096 runs  +69 130  106 709 ✔️ +60 797  13 239 💤 +7 677  1 148 +656 

Results for commit 05abeb3. ± Comparison against earlier commit b96b577.

Annotations

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_lazy_corrcov[time-3-0] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('x', 'time')
self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 3, dim = 'time', ddof = 0
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [3, 4, 5, 6, 7, 8])
    @pytest.mark.parametrize("dim", [None, "x", "time"])
    @requires_dask
    def test_lazy_corrcov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        # GH 5284
        from dask import is_dask_collection
    
        da_a, da_b = array_tuples[n]
    
        with raise_if_dask_computes():
>           cov = xr.cov(da_a.chunk(), da_b.chunk(), dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1600: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('x', 'time')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_lazy_corrcov[time-3-1] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('x', 'time')
self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 3, dim = 'time', ddof = 1
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [3, 4, 5, 6, 7, 8])
    @pytest.mark.parametrize("dim", [None, "x", "time"])
    @requires_dask
    def test_lazy_corrcov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        # GH 5284
        from dask import is_dask_collection
    
        da_a, da_b = array_tuples[n]
    
        with raise_if_dask_computes():
>           cov = xr.cov(da_a.chunk(), da_b.chunk(), dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1600: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('x', 'time')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_lazy_corrcov[time-4-0] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('x', 'time')
self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 4, dim = 'time', ddof = 0
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [3, 4, 5, 6, 7, 8])
    @pytest.mark.parametrize("dim", [None, "x", "time"])
    @requires_dask
    def test_lazy_corrcov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        # GH 5284
        from dask import is_dask_collection
    
        da_a, da_b = array_tuples[n]
    
        with raise_if_dask_computes():
>           cov = xr.cov(da_a.chunk(), da_b.chunk(), dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1600: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('x', 'time')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_lazy_corrcov[time-4-1] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('x', 'time')
self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 4, dim = 'time', ddof = 1
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [3, 4, 5, 6, 7, 8])
    @pytest.mark.parametrize("dim", [None, "x", "time"])
    @requires_dask
    def test_lazy_corrcov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        # GH 5284
        from dask import is_dask_collection
    
        da_a, da_b = array_tuples[n]
    
        with raise_if_dask_computes():
>           cov = xr.cov(da_a.chunk(), da_b.chunk(), dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1600: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('x', 'time')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_lazy_corrcov[time-5-0] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('x', 'time')
self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 5, dim = 'time', ddof = 0
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [3, 4, 5, 6, 7, 8])
    @pytest.mark.parametrize("dim", [None, "x", "time"])
    @requires_dask
    def test_lazy_corrcov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        # GH 5284
        from dask import is_dask_collection
    
        da_a, da_b = array_tuples[n]
    
        with raise_if_dask_computes():
>           cov = xr.cov(da_a.chunk(), da_b.chunk(), dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1600: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('x', 'time')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_lazy_corrcov[time-5-1] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('x', 'time')
self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 5, dim = 'time', ddof = 1
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [3, 4, 5, 6, 7, 8])
    @pytest.mark.parametrize("dim", [None, "x", "time"])
    @requires_dask
    def test_lazy_corrcov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        # GH 5284
        from dask import is_dask_collection
    
        da_a, da_b = array_tuples[n]
    
        with raise_if_dask_computes():
>           cov = xr.cov(da_a.chunk(), da_b.chunk(), dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1600: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('x', 'time')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_lazy_corrcov[time-6-0] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('x', 'time')
self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 6, dim = 'time', ddof = 0
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [3, 4, 5, 6, 7, 8])
    @pytest.mark.parametrize("dim", [None, "x", "time"])
    @requires_dask
    def test_lazy_corrcov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        # GH 5284
        from dask import is_dask_collection
    
        da_a, da_b = array_tuples[n]
    
        with raise_if_dask_computes():
>           cov = xr.cov(da_a.chunk(), da_b.chunk(), dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1600: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('x', 'time')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_lazy_corrcov[time-6-1] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('x', 'time')
self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 6, dim = 'time', ddof = 1
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [3, 4, 5, 6, 7, 8])
    @pytest.mark.parametrize("dim", [None, "x", "time"])
    @requires_dask
    def test_lazy_corrcov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        # GH 5284
        from dask import is_dask_collection
    
        da_a, da_b = array_tuples[n]
    
        with raise_if_dask_computes():
>           cov = xr.cov(da_a.chunk(), da_b.chunk(), dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1600: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('x', 'time')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_lazy_corrcov[time-7-0] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('x', 'time')
self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 7, dim = 'time', ddof = 0
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [3, 4, 5, 6, 7, 8])
    @pytest.mark.parametrize("dim", [None, "x", "time"])
    @requires_dask
    def test_lazy_corrcov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        # GH 5284
        from dask import is_dask_collection
    
        da_a, da_b = array_tuples[n]
    
        with raise_if_dask_computes():
>           cov = xr.cov(da_a.chunk(), da_b.chunk(), dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1600: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('x', 'time')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_lazy_corrcov[time-7-1] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('x', 'time')
self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 7, dim = 'time', ddof = 1
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [3, 4, 5, 6, 7, 8])
    @pytest.mark.parametrize("dim", [None, "x", "time"])
    @requires_dask
    def test_lazy_corrcov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        # GH 5284
        from dask import is_dask_collection
    
        da_a, da_b = array_tuples[n]
    
        with raise_if_dask_computes():
>           cov = xr.cov(da_a.chunk(), da_b.chunk(), dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1600: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('x', 'time')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_lazy_corrcov[time-8-0] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('x', 'time')
self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 8, dim = 'time', ddof = 0
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [3, 4, 5, 6, 7, 8])
    @pytest.mark.parametrize("dim", [None, "x", "time"])
    @requires_dask
    def test_lazy_corrcov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        # GH 5284
        from dask import is_dask_collection
    
        da_a, da_b = array_tuples[n]
    
        with raise_if_dask_computes():
>           cov = xr.cov(da_a.chunk(), da_b.chunk(), dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1600: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('x', 'time')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_lazy_corrcov[time-8-1] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('x', 'time')
self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 8, dim = 'time', ddof = 1
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [3, 4, 5, 6, 7, 8])
    @pytest.mark.parametrize("dim", [None, "x", "time"])
    @requires_dask
    def test_lazy_corrcov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        # GH 5284
        from dask import is_dask_collection
    
        da_a, da_b = array_tuples[n]
    
        with raise_if_dask_computes():
>           cov = xr.cov(da_a.chunk(), da_b.chunk(), dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1600: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (x: 2, time: 2)>
dask.array<and_, shape=(2, 2), dtype=bool, chunksize=(2, 2), chunktype=numpy.ndarray>
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('x', 'time')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_cov[time-0-0] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('a', 'time', 'x')
self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[ True,  True,  True,  True],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 0, dim = 'time', ddof = 0
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [0, 1, 2])
    @pytest.mark.parametrize("dim", [None, "time"])
    def test_cov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        da_a, da_b = array_tuples[n]
    
        if dim is not None:
    
            def np_cov_ind(ts1, ts2, a, x):
                # Ensure the ts are aligned and missing values ignored
                ts1, ts2 = broadcast(ts1, ts2)
                valid_values = ts1.notnull() & ts2.notnull()
    
                # While dropping isn't ideal here, numpy will return nan
                # if any segment contains a NaN.
                ts1 = ts1.where(valid_values)
                ts2 = ts2.where(valid_values)
    
                return np.ma.cov(
                    np.ma.masked_invalid(ts1.sel(a=a, x=x).data.flatten()),
                    np.ma.masked_invalid(ts2.sel(a=a, x=x).data.flatten()),
                    ddof=ddof,
                )[0, 1]
    
            expected = np.zeros((3, 4))
            for a in [0, 1, 2]:
                for x in [0, 1, 2, 3]:
                    expected[a, x] = np_cov_ind(da_a, da_b, a=a, x=x)
>           actual = xr.cov(da_a, da_b, dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1637: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[ True,  True,  True,  True],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('a', 'time', 'x')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_cov[time-0-1] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('a', 'time', 'x')
self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[ True,  True,  True,  True],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 0, dim = 'time', ddof = 1
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [0, 1, 2])
    @pytest.mark.parametrize("dim", [None, "time"])
    def test_cov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        da_a, da_b = array_tuples[n]
    
        if dim is not None:
    
            def np_cov_ind(ts1, ts2, a, x):
                # Ensure the ts are aligned and missing values ignored
                ts1, ts2 = broadcast(ts1, ts2)
                valid_values = ts1.notnull() & ts2.notnull()
    
                # While dropping isn't ideal here, numpy will return nan
                # if any segment contains a NaN.
                ts1 = ts1.where(valid_values)
                ts2 = ts2.where(valid_values)
    
                return np.ma.cov(
                    np.ma.masked_invalid(ts1.sel(a=a, x=x).data.flatten()),
                    np.ma.masked_invalid(ts2.sel(a=a, x=x).data.flatten()),
                    ddof=ddof,
                )[0, 1]
    
            expected = np.zeros((3, 4))
            for a in [0, 1, 2]:
                for x in [0, 1, 2, 3]:
                    expected[a, x] = np_cov_ind(da_a, da_b, a=a, x=x)
>           actual = xr.cov(da_a, da_b, dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1637: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[ True,  True,  True,  True],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('a', 'time', 'x')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_cov[time-1-0] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('a', 'time', 'x')
self = <xarray.Variable (a: 3, time: 16, x: 4)>
array([[[False, False, False, False],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 1, dim = 'time', ddof = 0
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [0, 1, 2])
    @pytest.mark.parametrize("dim", [None, "time"])
    def test_cov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        da_a, da_b = array_tuples[n]
    
        if dim is not None:
    
            def np_cov_ind(ts1, ts2, a, x):
                # Ensure the ts are aligned and missing values ignored
                ts1, ts2 = broadcast(ts1, ts2)
                valid_values = ts1.notnull() & ts2.notnull()
    
                # While dropping isn't ideal here, numpy will return nan
                # if any segment contains a NaN.
                ts1 = ts1.where(valid_values)
                ts2 = ts2.where(valid_values)
    
                return np.ma.cov(
                    np.ma.masked_invalid(ts1.sel(a=a, x=x).data.flatten()),
                    np.ma.masked_invalid(ts2.sel(a=a, x=x).data.flatten()),
                    ddof=ddof,
                )[0, 1]
    
            expected = np.zeros((3, 4))
            for a in [0, 1, 2]:
                for x in [0, 1, 2, 3]:
                    expected[a, x] = np_cov_ind(da_a, da_b, a=a, x=x)
>           actual = xr.cov(da_a, da_b, dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1637: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (a: 3, time: 16, x: 4)>
array([[[False, False, False, False],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('a', 'time', 'x')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_cov[time-1-1] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('a', 'time', 'x')
self = <xarray.Variable (a: 3, time: 16, x: 4)>
array([[[False, False, False, False],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 1, dim = 'time', ddof = 1
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [0, 1, 2])
    @pytest.mark.parametrize("dim", [None, "time"])
    def test_cov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        da_a, da_b = array_tuples[n]
    
        if dim is not None:
    
            def np_cov_ind(ts1, ts2, a, x):
                # Ensure the ts are aligned and missing values ignored
                ts1, ts2 = broadcast(ts1, ts2)
                valid_values = ts1.notnull() & ts2.notnull()
    
                # While dropping isn't ideal here, numpy will return nan
                # if any segment contains a NaN.
                ts1 = ts1.where(valid_values)
                ts2 = ts2.where(valid_values)
    
                return np.ma.cov(
                    np.ma.masked_invalid(ts1.sel(a=a, x=x).data.flatten()),
                    np.ma.masked_invalid(ts2.sel(a=a, x=x).data.flatten()),
                    ddof=ddof,
                )[0, 1]
    
            expected = np.zeros((3, 4))
            for a in [0, 1, 2]:
                for x in [0, 1, 2, 3]:
                    expected[a, x] = np_cov_ind(da_a, da_b, a=a, x=x)
>           actual = xr.cov(da_a, da_b, dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1637: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (a: 3, time: 16, x: 4)>
array([[[False, False, False, False],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('a', 'time', 'x')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_cov[time-2-0] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('a', 'time', 'x')
self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[False, False, False, False],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [False, False, False, False]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 2, dim = 'time', ddof = 0
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [0, 1, 2])
    @pytest.mark.parametrize("dim", [None, "time"])
    def test_cov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        da_a, da_b = array_tuples[n]
    
        if dim is not None:
    
            def np_cov_ind(ts1, ts2, a, x):
                # Ensure the ts are aligned and missing values ignored
                ts1, ts2 = broadcast(ts1, ts2)
                valid_values = ts1.notnull() & ts2.notnull()
    
                # While dropping isn't ideal here, numpy will return nan
                # if any segment contains a NaN.
                ts1 = ts1.where(valid_values)
                ts2 = ts2.where(valid_values)
    
                return np.ma.cov(
                    np.ma.masked_invalid(ts1.sel(a=a, x=x).data.flatten()),
                    np.ma.masked_invalid(ts2.sel(a=a, x=x).data.flatten()),
                    ddof=ddof,
                )[0, 1]
    
            expected = np.zeros((3, 4))
            for a in [0, 1, 2]:
                for x in [0, 1, 2, 3]:
                    expected[a, x] = np_cov_ind(da_a, da_b, a=a, x=x)
>           actual = xr.cov(da_a, da_b, dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1637: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[False, False, False, False],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [False, False, False, False]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('a', 'time', 'x')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_cov[time-2-1] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('a', 'time', 'x')
self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[False, False, False, False],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [False, False, False, False]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 2, dim = 'time', ddof = 1
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("ddof", [0, 1])
    @pytest.mark.parametrize("n", [0, 1, 2])
    @pytest.mark.parametrize("dim", [None, "time"])
    def test_cov(
        n: int, dim: str | None, ddof: int, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        da_a, da_b = array_tuples[n]
    
        if dim is not None:
    
            def np_cov_ind(ts1, ts2, a, x):
                # Ensure the ts are aligned and missing values ignored
                ts1, ts2 = broadcast(ts1, ts2)
                valid_values = ts1.notnull() & ts2.notnull()
    
                # While dropping isn't ideal here, numpy will return nan
                # if any segment contains a NaN.
                ts1 = ts1.where(valid_values)
                ts2 = ts2.where(valid_values)
    
                return np.ma.cov(
                    np.ma.masked_invalid(ts1.sel(a=a, x=x).data.flatten()),
                    np.ma.masked_invalid(ts2.sel(a=a, x=x).data.flatten()),
                    ddof=ddof,
                )[0, 1]
    
            expected = np.zeros((3, 4))
            for a in [0, 1, 2]:
                for x in [0, 1, 2, 3]:
                    expected[a, x] = np_cov_ind(da_a, da_b, a=a, x=x)
>           actual = xr.cov(da_a, da_b, dim=dim, ddof=ddof)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1637: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[False, False, False, False],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [False, False, False, False]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('a', 'time', 'x')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_corr[time-0] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('a', 'time', 'x')
self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[ True,  True,  True,  True],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 0, dim = 'time'
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("n", [0, 1, 2])
    @pytest.mark.parametrize("dim", [None, "time"])
    def test_corr(
        n: int, dim: str | None, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        da_a, da_b = array_tuples[n]
    
        if dim is not None:
    
            def np_corr_ind(ts1, ts2, a, x):
                # Ensure the ts are aligned and missing values ignored
                ts1, ts2 = broadcast(ts1, ts2)
                valid_values = ts1.notnull() & ts2.notnull()
    
                ts1 = ts1.where(valid_values)
                ts2 = ts2.where(valid_values)
    
                return np.ma.corrcoef(
                    np.ma.masked_invalid(ts1.sel(a=a, x=x).data.flatten()),
                    np.ma.masked_invalid(ts2.sel(a=a, x=x).data.flatten()),
                )[0, 1]
    
            expected = np.zeros((3, 4))
            for a in [0, 1, 2]:
                for x in [0, 1, 2, 3]:
                    expected[a, x] = np_corr_ind(da_a, da_b, a=a, x=x)
>           actual = xr.corr(da_a, da_b, dim)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1687: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1435: in corr
    return _cov_corr(da_a, da_b, dim=dim, method="corr")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[ True,  True,  True,  True],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('a', 'time', 'x')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_corr[time-1] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('a', 'time', 'x')
self = <xarray.Variable (a: 3, time: 16, x: 4)>
array([[[False, False, False, False],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 1, dim = 'time'
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("n", [0, 1, 2])
    @pytest.mark.parametrize("dim", [None, "time"])
    def test_corr(
        n: int, dim: str | None, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        da_a, da_b = array_tuples[n]
    
        if dim is not None:
    
            def np_corr_ind(ts1, ts2, a, x):
                # Ensure the ts are aligned and missing values ignored
                ts1, ts2 = broadcast(ts1, ts2)
                valid_values = ts1.notnull() & ts2.notnull()
    
                ts1 = ts1.where(valid_values)
                ts2 = ts2.where(valid_values)
    
                return np.ma.corrcoef(
                    np.ma.masked_invalid(ts1.sel(a=a, x=x).data.flatten()),
                    np.ma.masked_invalid(ts2.sel(a=a, x=x).data.flatten()),
                )[0, 1]
    
            expected = np.zeros((3, 4))
            for a in [0, 1, 2]:
                for x in [0, 1, 2, 3]:
                    expected[a, x] = np_corr_ind(da_a, da_b, a=a, x=x)
>           actual = xr.corr(da_a, da_b, dim)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1687: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1435: in corr
    return _cov_corr(da_a, da_b, dim=dim, method="corr")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (a: 3, time: 16, x: 4)>
array([[[False, False, False, False],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('a', 'time', 'x')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_corr[time-2] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('a', 'time', 'x')
self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[False, False, False, False],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [False, False, False, False]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 2, dim = 'time'
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("n", [0, 1, 2])
    @pytest.mark.parametrize("dim", [None, "time"])
    def test_corr(
        n: int, dim: str | None, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        da_a, da_b = array_tuples[n]
    
        if dim is not None:
    
            def np_corr_ind(ts1, ts2, a, x):
                # Ensure the ts are aligned and missing values ignored
                ts1, ts2 = broadcast(ts1, ts2)
                valid_values = ts1.notnull() & ts2.notnull()
    
                ts1 = ts1.where(valid_values)
                ts2 = ts2.where(valid_values)
    
                return np.ma.corrcoef(
                    np.ma.masked_invalid(ts1.sel(a=a, x=x).data.flatten()),
                    np.ma.masked_invalid(ts2.sel(a=a, x=x).data.flatten()),
                )[0, 1]
    
            expected = np.zeros((3, 4))
            for a in [0, 1, 2]:
                for x in [0, 1, 2, 3]:
                    expected[a, x] = np_corr_ind(da_a, da_b, a=a, x=x)
>           actual = xr.corr(da_a, da_b, dim)

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1687: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1435: in corr
    return _cov_corr(da_a, da_b, dim=dim, method="corr")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[False, False, False, False],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [False, False, False, False]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('a', 'time', 'x')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_covcorr_consistency[time-0] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('a', 'time', 'x')
self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[ True,  True,  True,  True],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 0, dim = 'time'
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("n", range(9))
    @pytest.mark.parametrize("dim", [None, "time", "x"])
    def test_covcorr_consistency(
        n: int, dim: str | None, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        da_a, da_b = array_tuples[n]
        # Testing that xr.corr and xr.cov are consistent with each other
        # 1. Broadcast the two arrays
        da_a, da_b = broadcast(da_a, da_b)
        # 2. Ignore the nans
        valid_values = da_a.notnull() & da_b.notnull()
        da_a = da_a.where(valid_values)
        da_b = da_b.where(valid_values)
    
>       expected = xr.cov(da_a, da_b, dim=dim, ddof=0) / (
            da_a.std(dim=dim) * da_b.std(dim=dim)
        )

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1724: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[ True,  True,  True,  True],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('a', 'time', 'x')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_covcorr_consistency[time-1] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('a', 'time', 'x')
self = <xarray.Variable (a: 3, time: 20, x: 4)>
array([[[False, False, False, False],
        [False, False, False, False],
 ...e],
        [ True,  True,  True,  True],
        [False, False, False, False],
        [False, False, False, False]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 1, dim = 'time'
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("n", range(9))
    @pytest.mark.parametrize("dim", [None, "time", "x"])
    def test_covcorr_consistency(
        n: int, dim: str | None, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        da_a, da_b = array_tuples[n]
        # Testing that xr.corr and xr.cov are consistent with each other
        # 1. Broadcast the two arrays
        da_a, da_b = broadcast(da_a, da_b)
        # 2. Ignore the nans
        valid_values = da_a.notnull() & da_b.notnull()
        da_a = da_a.where(valid_values)
        da_b = da_b.where(valid_values)
    
>       expected = xr.cov(da_a, da_b, dim=dim, ddof=0) / (
            da_a.std(dim=dim) * da_b.std(dim=dim)
        )

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1724: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (a: 3, time: 20, x: 4)>
array([[[False, False, False, False],
        [False, False, False, False],
 ...e],
        [ True,  True,  True,  True],
        [False, False, False, False],
        [False, False, False, False]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('a', 'time', 'x')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_covcorr_consistency[time-2] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('a', 'time', 'x')
self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[False, False, False, False],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [False, False, False, False]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 2, dim = 'time'
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("n", range(9))
    @pytest.mark.parametrize("dim", [None, "time", "x"])
    def test_covcorr_consistency(
        n: int, dim: str | None, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        da_a, da_b = array_tuples[n]
        # Testing that xr.corr and xr.cov are consistent with each other
        # 1. Broadcast the two arrays
        da_a, da_b = broadcast(da_a, da_b)
        # 2. Ignore the nans
        valid_values = da_a.notnull() & da_b.notnull()
        da_a = da_a.where(valid_values)
        da_b = da_b.where(valid_values)
    
>       expected = xr.cov(da_a, da_b, dim=dim, ddof=0) / (
            da_a.std(dim=dim) * da_b.std(dim=dim)
        )

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1724: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (a: 3, time: 18, x: 4)>
array([[[False, False, False, False],
        [ True,  True,  True,  True],
 ...e],
        [ True,  True,  True,  True],
        [ True,  True,  True,  True],
        [False, False, False, False]]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('a', 'time', 'x')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError

Check warning on line 0 in xarray.tests.test_computation

See this annotation in the file changed.

@github-actions github-actions / Test Results

All 7 runs failed: test_covcorr_consistency[time-3] (xarray.tests.test_computation)

artifacts/Test results for Linux-3.10/pytest.xml [took 0s]
artifacts/Test results for Linux-3.11/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.11/pytest.xml [took 0s]
artifacts/Test results for macOS-3.9/pytest.xml [took 0s]
Raw output
ValueError: 't' not found in array dimensions ('x', 'time')
self = <xarray.Variable (x: 2, time: 2)>
array([[ True,  True],
       [ True, False]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
>           out: int = self.dims.index(dim)
E           ValueError: tuple.index(x): x not in tuple

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:617: ValueError

During handling of the above exception, another exception occurred:

n = 3, dim = 'time'
array_tuples = [(<xarray.DataArray (a: 3, time: 18, x: 4)>
array([[[0.5488135 , 0.71518937, 0.60276338, 0.54488318],
        [0.42365... time, <xarray.DataArray (x: 2, time: 2)>
array([[1, 2],
       [2, 1]])
Dimensions without coordinates: x, time), ...]

    @pytest.mark.parametrize("n", range(9))
    @pytest.mark.parametrize("dim", [None, "time", "x"])
    def test_covcorr_consistency(
        n: int, dim: str | None, array_tuples: tuple[xr.DataArray, xr.DataArray]
    ) -> None:
        da_a, da_b = array_tuples[n]
        # Testing that xr.corr and xr.cov are consistent with each other
        # 1. Broadcast the two arrays
        da_a, da_b = broadcast(da_a, da_b)
        # 2. Ignore the nans
        valid_values = da_a.notnull() & da_b.notnull()
        da_a = da_a.where(valid_values)
        da_b = da_b.where(valid_values)
    
>       expected = xr.cov(da_a, da_b, dim=dim, ddof=0) / (
            da_a.std(dim=dim) * da_b.std(dim=dim)
        )

/Users/runner/work/xarray/xarray/xarray/tests/test_computation.py:1724: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1357: in cov
    return _cov_corr(da_a, da_b, dim=dim, ddof=ddof, method="cov")
/Users/runner/work/xarray/xarray/xarray/core/computation.py:1456: in _cov_corr
    valid_count = valid_values.sum(dim) - ddof
/Users/runner/work/xarray/xarray/xarray/core/_aggregations.py:1856: in sum
    return self.reduce(
/Users/runner/work/xarray/xarray/xarray/core/dataarray.py:3715: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
/Users/runner/work/xarray/xarray/xarray/core/variable.py:1776: in reduce
    result = super().reduce(
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:711: in reduce
    axis = self._get_axis_nums(dim)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in _get_axis_nums
    return tuple(self._get_axis_num(d) for d in dims)
/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:613: in <genexpr>
    return tuple(self._get_axis_num(d) for d in dims)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <xarray.Variable (x: 2, time: 2)>
array([[ True,  True],
       [ True, False]])
dim = 't'

    def _get_axis_num(self: Any, dim: _Dim) -> int:
        try:
            out: int = self.dims.index(dim)
            return out
        except ValueError:
>           raise ValueError(f"{dim!r} not found in array dimensions {self.dims!r}")
E           ValueError: 't' not found in array dimensions ('x', 'time')

/Users/runner/work/xarray/xarray/xarray/namedarray/core.py:620: ValueError