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

Miscellaneous improvements for 2023-W43 #105

Merged
merged 47 commits into from
Oct 27, 2023
Merged

Miscellaneous improvements for 2023-W43 #105

merged 47 commits into from
Oct 27, 2023

Conversation

khaeru
Copy link
Owner

@khaeru khaeru commented Oct 27, 2023

  • 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
  • Add convenience methods similar to add_mul() to automatically determine dimensionality of result automatically for: add(), div(), sub(), and any other basic arithimetic operations.
  • Test binops, including unit handling: +, -, /, *.
  • Extend Key.__div__ to handle k / ("a", "b"), k1 / k2.
  • Extend Key.__mul__ to handle k * ("a", "b"), k1 * k2.
  • Extend testing and confirmed support to Python 3.12.
  • Replace black formatting with ruff format.

PR checklist

  • Checks all ✅
  • Update documentation
  • Update doc/whatsnew.rst

@khaeru khaeru self-assigned this Oct 27, 2023
@khaeru khaeru added bug Something isn't working enh New feature or request labels Oct 27, 2023
khaeru added a commit that referenced this pull request Oct 27, 2023
@codecov-commenter
Copy link

codecov-commenter commented Oct 27, 2023

Codecov Report

Merging #105 (bb88a90) into main (0fff94a) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##              main      #105    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files           47        48     +1     
  Lines         3926      4041   +115     
==========================================
+ Hits          3926      4041   +115     
Files Coverage Δ
genno/caching.py 100.00% <ø> (ø)
genno/compat/graphviz.py 100.00% <ø> (ø)
genno/compat/pint.py 100.00% <ø> (ø)
genno/compat/plotnine/plot.py 100.00% <100.00%> (ø)
genno/compat/pyam/__init__.py 100.00% <ø> (ø)
genno/compat/pyam/operator.py 100.00% <100.00%> (ø)
genno/compat/sdmx.py 100.00% <ø> (ø)
genno/compat/xarray.py 100.00% <100.00%> (ø)
genno/computations.py 100.00% <100.00%> (ø)
genno/config.py 100.00% <100.00%> (ø)
... and 21 more

khaeru added a commit that referenced this pull request Oct 27, 2023
@khaeru khaeru merged commit 9ff8e0c into main Oct 27, 2023
17 checks passed
@khaeru khaeru deleted the enh/2023-W43 branch October 27, 2023 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enh New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants