Address recent CI failures occurring with xarray >= 2023.10.0 on Python ≥3.9:
___________________ test_interpolate[sparsedataarray-shape0] ___________________
genno/core/sparsedataarray.py:66: in dense
return self.da._replace(variable=self.da.variable._to_dense())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.Variable ()>
array(0.44617429)
Attributes:
_unit: kilogram
def _to_dense(self) -> Self:
"""
Change backend from sparse to np.array
"""
from xarray.namedarray._typing import _sparsearrayfunction_or_api
if isinstance(self._data, _sparsearrayfunction_or_api):
# return self._replace(data=self._data.todense())
data_: np.ndarray[Any, Any] = self._data.todense()
return self._replace(data=data_)
else:
> raise TypeError("self.data is not a sparse array")
E TypeError: self.data is not a sparse array
/opt/hostedtoolcache/Python/3.11.6/x64/lib/python3.11/site-packages/xarray/namedarray/core.py:813: TypeError
[x] Add convenience methods similar to add_mul() to automatically determine dimensionality of result automatically for: add(), div(), sub(), and any other basic arithimetic operations.
[x] Test binops, including unit handling: +, -, /, *.
[x] Extend Key.__div__ to handle k / ("a", "b"), k1 / k2.
[x] Extend Key.__mul__ to handle k * ("a", "b"), k1 * k2.
Extend testing and confirmed support to Python 3.12.
Address recent CI failures occurring with xarray >= 2023.10.0 on Python ≥3.9:
add_mul()
to automatically determine dimensionality of result automatically for:add()
,div()
,sub()
, and any other basic arithimetic operations.+
,-
,/
,*
.Key.__div__
to handlek / ("a", "b")
,k1 / k2
.Key.__mul__
to handlek * ("a", "b")
,k1 * k2
.black
formatting withruff format
.PR checklist