Skip to content

run CI on python=3.12 #10990

run CI on python=3.12

run CI on python=3.12 #10990

This check has been archived and is scheduled for deletion. Learn more about checks retention
GitHub Actions / Test Results failed Jan 12, 2024 in 0s

146 fail, 1 850 skipped, 17 556 pass in 1h 51m 23s

     13 files       13 suites   1h 51m 23s ⏱️
 19 552 tests  17 556 ✅  1 850 💤 146 ❌
232 260 runs  203 914 ✅ 28 052 💤 294 ❌

Results for commit b5149c7.

Annotations

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

3 out of 12 runs failed: test_aggregation[float64-method_cumprod] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x0000024EB5E6E5A0>
func = method_cumprod, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

D:\a\xarray\xarray\xarray\tests\test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\xarray\xarray\xarray\tests\test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
D:\a\xarray\xarray\xarray\namedarray\_aggregations.py:944: in cumprod
    return self.reduce(
D:\a\xarray\xarray\xarray\core\variable.py:1756: in reduce
    result = super().reduce(
D:\a\xarray\xarray\xarray\namedarray\core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
D:\a\xarray\xarray\xarray\namedarray\core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity([0. 0. 0. 0. 0. 0. 0. 0. 0. 0.], 'dimensionless')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\pint\facets\numpy\quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

3 out of 12 runs failed: test_aggregation[float64-method_cumsum] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x0000024EB5E6E630>
func = method_cumsum, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

D:\a\xarray\xarray\xarray\tests\test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\xarray\xarray\xarray\tests\test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
D:\a\xarray\xarray\xarray\namedarray\_aggregations.py:872: in cumsum
    return self.reduce(
D:\a\xarray\xarray\xarray\core\variable.py:1756: in reduce
    result = super().reduce(
D:\a\xarray\xarray\xarray\namedarray\core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
D:\a\xarray\xarray\xarray\namedarray\core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity([0.         0.11111111 0.33333333 0.66666667 1.11111111 1.66666667
 2.33333333 3.11111111 4.         5.        ], 'meter')>
t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\pint\facets\numpy\quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

3 out of 12 runs failed: test_aggregation[float64-method_max] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x0000024EB5E6E6C0>
func = method_max, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

D:\a\xarray\xarray\xarray\tests\test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\xarray\xarray\xarray\tests\test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
D:\a\xarray\xarray\xarray\namedarray\_aggregations.py:250: in max
    return self.reduce(
D:\a\xarray\xarray\xarray\core\variable.py:1756: in reduce
    result = super().reduce(
D:\a\xarray\xarray\xarray\namedarray\core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
D:\a\xarray\xarray\xarray\namedarray\core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity(1.0, 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\pint\facets\numpy\quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

3 out of 12 runs failed: test_aggregation[float64-method_mean] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x0000024EB5E6E750>
func = method_mean, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

D:\a\xarray\xarray\xarray\tests\test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\xarray\xarray\xarray\tests\test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
D:\a\xarray\xarray\xarray\namedarray\_aggregations.py:390: in mean
    return self.reduce(
D:\a\xarray\xarray\xarray\core\variable.py:1756: in reduce
    result = super().reduce(
D:\a\xarray\xarray\xarray\namedarray\core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
D:\a\xarray\xarray\xarray\namedarray\core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity(0.5, 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\pint\facets\numpy\quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

3 out of 12 runs failed: test_aggregation[float64-method_median] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x0000024EB5E6E7E0>
func = method_median, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

D:\a\xarray\xarray\xarray\tests\test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\xarray\xarray\xarray\tests\test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
D:\a\xarray\xarray\xarray\namedarray\_aggregations.py:800: in median
    return self.reduce(
D:\a\xarray\xarray\xarray\core\variable.py:1756: in reduce
    result = super().reduce(
D:\a\xarray\xarray\xarray\namedarray\core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
D:\a\xarray\xarray\xarray\namedarray\core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity(0.5, 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\pint\facets\numpy\quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

3 out of 12 runs failed: test_aggregation[float64-method_min] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x0000024EB5E6E870>
func = method_min, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

D:\a\xarray\xarray\xarray\tests\test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\xarray\xarray\xarray\tests\test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
D:\a\xarray\xarray\xarray\namedarray\_aggregations.py:318: in min
    return self.reduce(
D:\a\xarray\xarray\xarray\core\variable.py:1756: in reduce
    result = super().reduce(
D:\a\xarray\xarray\xarray\namedarray\core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
D:\a\xarray\xarray\xarray\namedarray\core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity(0.0, 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\pint\facets\numpy\quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

3 out of 12 runs failed: test_aggregation[float64-method_prod] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x0000024EB5E6E900>
func = method_prod, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

D:\a\xarray\xarray\xarray\tests\test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\xarray\xarray\xarray\tests\test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
D:\a\xarray\xarray\xarray\namedarray\_aggregations.py:475: in prod
    return self.reduce(
D:\a\xarray\xarray\xarray\core\variable.py:1756: in reduce
    result = super().reduce(
D:\a\xarray\xarray\xarray\namedarray\core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
D:\a\xarray\xarray\xarray\namedarray\core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity(0.0, 'meter ** 10')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\pint\facets\numpy\quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

3 out of 12 runs failed: test_aggregation[float64-method_std] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x0000024EB5E6E990>
func = method_std, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

D:\a\xarray\xarray\xarray\tests\test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\xarray\xarray\xarray\tests\test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
D:\a\xarray\xarray\xarray\namedarray\_aggregations.py:644: in std
    return self.reduce(
D:\a\xarray\xarray\xarray\core\variable.py:1756: in reduce
    result = super().reduce(
D:\a\xarray\xarray\xarray\namedarray\core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
D:\a\xarray\xarray\xarray\namedarray\core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity(0.31914236925211265, 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\pint\facets\numpy\quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

3 out of 12 runs failed: test_aggregation[float64-method_sum] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x0000024EB5E6EA20>
func = method_sum, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

D:\a\xarray\xarray\xarray\tests\test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\xarray\xarray\xarray\tests\test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
D:\a\xarray\xarray\xarray\namedarray\_aggregations.py:561: in sum
    return self.reduce(
D:\a\xarray\xarray\xarray\core\variable.py:1756: in reduce
    result = super().reduce(
D:\a\xarray\xarray\xarray\namedarray\core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
D:\a\xarray\xarray\xarray\namedarray\core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity(5.0, 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\pint\facets\numpy\quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

3 out of 12 runs failed: test_aggregation[float64-method_var] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x0000024EB5E6EAB0>
func = method_var, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

D:\a\xarray\xarray\xarray\tests\test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\xarray\xarray\xarray\tests\test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
D:\a\xarray\xarray\xarray\namedarray\_aggregations.py:727: in var
    return self.reduce(
D:\a\xarray\xarray\xarray\core\variable.py:1756: in reduce
    result = super().reduce(
D:\a\xarray\xarray\xarray\namedarray\core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
D:\a\xarray\xarray\xarray\namedarray\core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity(0.10185185185185183, 'meter ** 2')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\pint\facets\numpy\quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 9 runs failed: test_aggregation[int64-method_cumprod] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x7fb0684a9130>
func = method_cumprod, dtype = dtype('int64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/namedarray/_aggregations.py:944: in cumprod
    return self.reduce(
/home/runner/work/xarray/xarray/xarray/core/variable.py:1756: in reduce
    result = super().reduce(
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Quantity([0 0 0 0 0 0 0 0 0 0], 'dimensionless')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

/home/runner/micromamba/envs/xarray-tests/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 9 runs failed: test_aggregation[int64-method_cumsum] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x7fb0684a91c0>
func = method_cumsum, dtype = dtype('int64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/namedarray/_aggregations.py:872: in cumsum
    return self.reduce(
/home/runner/work/xarray/xarray/xarray/core/variable.py:1756: in reduce
    result = super().reduce(
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Quantity([0 0 0 0 0 0 0 0 0 1], 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

/home/runner/micromamba/envs/xarray-tests/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 9 runs failed: test_aggregation[int64-method_max] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x7fb0684a9250>
func = method_max, dtype = dtype('int64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/namedarray/_aggregations.py:250: in max
    return self.reduce(
/home/runner/work/xarray/xarray/xarray/core/variable.py:1756: in reduce
    result = super().reduce(
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Quantity(1, 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

/home/runner/micromamba/envs/xarray-tests/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 9 runs failed: test_aggregation[int64-method_mean] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x7fb0684a92e0>
func = method_mean, dtype = dtype('int64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/namedarray/_aggregations.py:390: in mean
    return self.reduce(
/home/runner/work/xarray/xarray/xarray/core/variable.py:1756: in reduce
    result = super().reduce(
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Quantity(0.1, 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

/home/runner/micromamba/envs/xarray-tests/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 9 runs failed: test_aggregation[int64-method_median] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x7fb0684a93a0>
func = method_median, dtype = dtype('int64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/namedarray/_aggregations.py:800: in median
    return self.reduce(
/home/runner/work/xarray/xarray/xarray/core/variable.py:1756: in reduce
    result = super().reduce(
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Quantity(0.0, 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

/home/runner/micromamba/envs/xarray-tests/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 9 runs failed: test_aggregation[int64-method_min] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x7fb0684a9460>
func = method_min, dtype = dtype('int64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/namedarray/_aggregations.py:318: in min
    return self.reduce(
/home/runner/work/xarray/xarray/xarray/core/variable.py:1756: in reduce
    result = super().reduce(
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Quantity(0, 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

/home/runner/micromamba/envs/xarray-tests/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 9 runs failed: test_aggregation[int64-method_prod] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x7fb0684a94f0>
func = method_prod, dtype = dtype('int64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/namedarray/_aggregations.py:475: in prod
    return self.reduce(
/home/runner/work/xarray/xarray/xarray/core/variable.py:1756: in reduce
    result = super().reduce(
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Quantity(0, 'meter ** 10')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

/home/runner/micromamba/envs/xarray-tests/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 9 runs failed: test_aggregation[int64-method_std] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x7fb0684a9580>
func = method_std, dtype = dtype('int64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/namedarray/_aggregations.py:644: in std
    return self.reduce(
/home/runner/work/xarray/xarray/xarray/core/variable.py:1756: in reduce
    result = super().reduce(
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Quantity(0.30000000000000004, 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

/home/runner/micromamba/envs/xarray-tests/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 9 runs failed: test_aggregation[int64-method_sum] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x7fb0684a9610>
func = method_sum, dtype = dtype('int64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/namedarray/_aggregations.py:561: in sum
    return self.reduce(
/home/runner/work/xarray/xarray/xarray/core/variable.py:1756: in reduce
    result = super().reduce(
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Quantity(1, 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

/home/runner/micromamba/envs/xarray-tests/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 9 runs failed: test_aggregation[int64-method_var] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x7fb0684a96a0>
func = method_var, dtype = dtype('int64')

    @pytest.mark.parametrize(
        "func",
        (
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("argsort"),
            method("cumprod"),
            method("cumsum"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("std"),
            method("sum"),
            method("var"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.linspace(0, 1, 10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        variable = xr.Variable("x", array)
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in func.kwargs:
            numpy_kwargs["axis"] = variable.get_axis_num(numpy_kwargs.pop("dim"))
    
        units = extract_units(func(array, **numpy_kwargs))
        expected = attach_units(func(strip_units(variable)), units)
>       actual = func(variable)

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:1547: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/namedarray/_aggregations.py:727: in var
    return self.reduce(
/home/runner/work/xarray/xarray/xarray/core/variable.py:1756: in reduce
    result = super().reduce(
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Quantity(0.09000000000000001, 'meter ** 2')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

/home/runner/micromamba/envs/xarray-tests/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

3 out of 12 runs failed: test_aggregate_complex (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x0000024EB5E6DC70>

    def test_aggregate_complex(self):
        variable = xr.Variable("x", [1, 2j, np.nan] * unit_registry.m)
        expected = xr.Variable((), (0.5 + 1j) * unit_registry.m)
>       actual = variable.mean()

D:\a\xarray\xarray\xarray\tests\test_units.py:1555: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\xarray\xarray\xarray\namedarray\_aggregations.py:390: in mean
    return self.reduce(
D:\a\xarray\xarray\xarray\core\variable.py:1756: in reduce
    result = super().reduce(
D:\a\xarray\xarray\xarray\namedarray\core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
D:\a\xarray\xarray\xarray\namedarray\core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity((0.5+1j), 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\pint\facets\numpy\quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

3 out of 12 runs failed: test_computation[float64-method_reduce] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x00000285F0CFB2C0>
func = method_reduce, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "func",
        (
            method("coarsen", windows={"y": 2}, func=np.mean),
            method("quantile", q=[0.25, 0.75]),
            pytest.param(
                method("rank", dim="x"),
                marks=pytest.mark.skip(reason="rank not implemented for non-ndarray"),
            ),
            method("roll", {"x": 2}),
            pytest.param(
                method("rolling_window", "x", 3, "window"),
                marks=pytest.mark.xfail(reason="converts to ndarray"),
            ),
            method("reduce", np.std, "x"),
            method("round", 2),
            method("shift", {"x": -2}),
            method("transpose", "y", "x"),
        ),
        ids=repr,
    )
    def test_computation(self, func, dtype):
        base_unit = unit_registry.m
        array = np.linspace(0, 5, 5 * 10).reshape(5, 10).astype(dtype) * base_unit
        variable = xr.Variable(("x", "y"), array)
    
        expected = attach_units(func(strip_units(variable)), extract_units(variable))
    
>       actual = func(variable)

D:\a\xarray\xarray\xarray\tests\test_units.py:2035: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\xarray\xarray\xarray\tests\test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
D:\a\xarray\xarray\xarray\core\variable.py:1756: in reduce
    result = super().reduce(
D:\a\xarray\xarray\xarray\namedarray\core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
D:\a\xarray\xarray\xarray\namedarray\core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity([1.44307506 1.44307506 1.44307506 1.44307506 1.44307506 1.44307506
 1.44307506 1.44307506 1.44307506 1.44307506], 'meter')>
t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\pint\facets\numpy\quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestVariable

See this annotation in the file changed.

@github-actions github-actions / Test Results

2 out of 9 runs failed: test_computation[int64-method_reduce] (xarray.tests.test_units.TestVariable)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestVariable object at 0x7f2323617e60>
func = method_reduce, dtype = dtype('int64')

    @pytest.mark.parametrize(
        "func",
        (
            method("coarsen", windows={"y": 2}, func=np.mean),
            method("quantile", q=[0.25, 0.75]),
            pytest.param(
                method("rank", dim="x"),
                marks=pytest.mark.skip(reason="rank not implemented for non-ndarray"),
            ),
            method("roll", {"x": 2}),
            pytest.param(
                method("rolling_window", "x", 3, "window"),
                marks=pytest.mark.xfail(reason="converts to ndarray"),
            ),
            method("reduce", np.std, "x"),
            method("round", 2),
            method("shift", {"x": -2}),
            method("transpose", "y", "x"),
        ),
        ids=repr,
    )
    def test_computation(self, func, dtype):
        base_unit = unit_registry.m
        array = np.linspace(0, 5, 5 * 10).reshape(5, 10).astype(dtype) * base_unit
        variable = xr.Variable(("x", "y"), array)
    
        expected = attach_units(func(strip_units(variable)), extract_units(variable))
    
>       actual = func(variable)

/home/runner/work/xarray/xarray/xarray/tests/test_units.py:2035: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/runner/work/xarray/xarray/xarray/tests/test_units.py:336: in __call__
    return func(*all_args, **all_kwargs)
/home/runner/work/xarray/xarray/xarray/core/variable.py:1756: in reduce
    result = super().reduce(
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
/home/runner/work/xarray/xarray/xarray/namedarray/core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Quantity([1.41421356 1.41421356 1.41421356 1.41421356 1.41421356 1.41421356
 1.41421356 1.41421356 1.41421356 1.72046505], 'meter')>
t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

/home/runner/micromamba/envs/xarray-tests/lib/python3.12/site-packages/pint/facets/numpy/quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestDataArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

3 out of 12 runs failed: test_aggregation[float64-function_max] (xarray.tests.test_units.TestDataArray)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestDataArray object at 0x00000285F0D2F8F0>
func = function_max, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "func",
        (
            function("all"),
            function("any"),
            pytest.param(
                function("argmax"),
                marks=pytest.mark.skip(
                    reason="calling np.argmax as a function on xarray objects is not "
                    "supported"
                ),
            ),
            pytest.param(
                function("argmin"),
                marks=pytest.mark.skip(
                    reason="calling np.argmin as a function on xarray objects is not "
                    "supported"
                ),
            ),
            function("max"),
            function("mean"),
            pytest.param(
                function("median"),
                marks=pytest.mark.skip(
                    reason="median does not work with dataarrays yet"
                ),
            ),
            function("min"),
            function("prod"),
            function("sum"),
            function("std"),
            function("var"),
            function("cumsum"),
            function("cumprod"),
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("sum"),
            method("std"),
            method("var"),
            method("cumsum"),
            method("cumprod"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.arange(10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        data_array = xr.DataArray(data=array, dims="x")
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in numpy_kwargs:
            numpy_kwargs["axis"] = data_array.get_axis_num(numpy_kwargs.pop("dim"))
    
        # units differ based on the applied function, so we need to
        # first compute the units
        units = extract_units(func(array))
        expected = attach_units(func(strip_units(data_array)), units)
>       actual = func(data_array)

D:\a\xarray\xarray\xarray\tests\test_units.py:2403: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\xarray\xarray\xarray\tests\test_units.py:371: in __call__
    return self.func(*all_args, **all_kwargs)
C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\core\fromnumeric.py:2810: in max
    return _wrapreduction(a, np.maximum, 'max', axis, None, out,
C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\core\fromnumeric.py:86: in _wrapreduction
    return reduction(axis=axis, out=out, **passkwargs)
D:\a\xarray\xarray\xarray\core\_aggregations.py:1501: in max
    return self.reduce(
D:\a\xarray\xarray\xarray\core\dataarray.py:3776: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
D:\a\xarray\xarray\xarray\core\variable.py:1756: in reduce
    result = super().reduce(
D:\a\xarray\xarray\xarray\namedarray\core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
D:\a\xarray\xarray\xarray\namedarray\core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity(9.0, 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\pint\facets\numpy\quantity.py:118: UnitStrippedWarning

Check warning on line 0 in xarray.tests.test_units.TestDataArray

See this annotation in the file changed.

@github-actions github-actions / Test Results

3 out of 12 runs failed: test_aggregation[float64-function_mean] (xarray.tests.test_units.TestDataArray)

artifacts/Test results for Linux-3.12/pytest.xml [took 0s]
artifacts/Test results for Windows-3.12/pytest.xml [took 0s]
artifacts/Test results for macOS-3.12/pytest.xml [took 0s]
Raw output
pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.
self = <xarray.tests.test_units.TestDataArray object at 0x00000285F0D2F980>
func = function_mean, dtype = dtype('float64')

    @pytest.mark.parametrize(
        "func",
        (
            function("all"),
            function("any"),
            pytest.param(
                function("argmax"),
                marks=pytest.mark.skip(
                    reason="calling np.argmax as a function on xarray objects is not "
                    "supported"
                ),
            ),
            pytest.param(
                function("argmin"),
                marks=pytest.mark.skip(
                    reason="calling np.argmin as a function on xarray objects is not "
                    "supported"
                ),
            ),
            function("max"),
            function("mean"),
            pytest.param(
                function("median"),
                marks=pytest.mark.skip(
                    reason="median does not work with dataarrays yet"
                ),
            ),
            function("min"),
            function("prod"),
            function("sum"),
            function("std"),
            function("var"),
            function("cumsum"),
            function("cumprod"),
            method("all"),
            method("any"),
            method("argmax", dim="x"),
            method("argmin", dim="x"),
            method("max"),
            method("mean"),
            method("median"),
            method("min"),
            method("prod"),
            method("sum"),
            method("std"),
            method("var"),
            method("cumsum"),
            method("cumprod"),
        ),
        ids=repr,
    )
    def test_aggregation(self, func, dtype):
        array = np.arange(10).astype(dtype) * (
            unit_registry.m if func.name != "cumprod" else unit_registry.dimensionless
        )
        data_array = xr.DataArray(data=array, dims="x")
    
        numpy_kwargs = func.kwargs.copy()
        if "dim" in numpy_kwargs:
            numpy_kwargs["axis"] = data_array.get_axis_num(numpy_kwargs.pop("dim"))
    
        # units differ based on the applied function, so we need to
        # first compute the units
        units = extract_units(func(array))
        expected = attach_units(func(strip_units(data_array)), units)
>       actual = func(data_array)

D:\a\xarray\xarray\xarray\tests\test_units.py:2403: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\xarray\xarray\xarray\tests\test_units.py:371: in __call__
    return self.func(*all_args, **all_kwargs)
C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\numpy\core\fromnumeric.py:3502: in mean
    return mean(axis=axis, dtype=dtype, out=out, **kwargs)
D:\a\xarray\xarray\xarray\core\_aggregations.py:1663: in mean
    return self.reduce(
D:\a\xarray\xarray\xarray\core\dataarray.py:3776: in reduce
    var = self.variable.reduce(func, dim, axis, keep_attrs, keepdims, **kwargs)
D:\a\xarray\xarray\xarray\core\variable.py:1756: in reduce
    result = super().reduce(
D:\a\xarray\xarray\xarray\namedarray\core.py:800: in reduce
    return from_array(dims, data, attrs=self._attrs)
D:\a\xarray\xarray\xarray\namedarray\core.py:204: in from_array
    return NamedArray(dims, np.asarray(data), attrs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Quantity(4.5, 'meter')>, t = None

    def __array__(self, t=None) -> np.ndarray:
>       warnings.warn(
            "The unit of the quantity is stripped when downcasting to ndarray.",
            UnitStrippedWarning,
            stacklevel=2,
        )
E       pint.errors.UnitStrippedWarning: The unit of the quantity is stripped when downcasting to ndarray.

C:\Users\runneradmin\micromamba\envs\xarray-tests\Lib\site-packages\pint\facets\numpy\quantity.py:118: UnitStrippedWarning