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

Generalize reporting.Quantity in preparation for sparse xarray #317

Merged
merged 22 commits into from Jun 19, 2020

Conversation

khaeru
Copy link
Member

@khaeru khaeru commented Apr 25, 2020

We have two internal representations of a reporting Quantity:

  • reporting.attrseries, which makes a pandas.Series act like a sparse xr.DataArray, e.g. not caring about order of dimensions.
  • reporting.sparsedataarray (added by this PR) which uses an xr.DataArray backed by pydata/sparse data storage.

The pydata/sparse support via xarray is now complete enough that we could use it in ixmp.reporting still maturing, with some remaining bugs, e.g. pydata/sparse#360. This PR cleans up the code so that the two internal representations of a Quantity are 100% interchangeable. It does not actually switch away from reporting.attrseries, which remains the default; that switch can be made later.

Some of the code in sparsedataarray should be contributed upstream (e.g. pydata/xarray#4007); once they are accepted by xarray, this helper code will shrink and can eventually be eliminated.

How to review

Note that CI checks all pass.

PR checklist

  • Tests added.
  • Documentation added.
  • Release notes updated.

@codecov
Copy link

codecov bot commented Apr 26, 2020

Codecov Report

Merging #317 into master will increase coverage by 0.64%.
The diff coverage is 99.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #317      +/-   ##
==========================================
+ Coverage   95.15%   95.79%   +0.64%     
==========================================
  Files          42       45       +3     
  Lines        4682     4876     +194     
==========================================
+ Hits         4455     4671     +216     
+ Misses        227      205      -22     
Impacted Files Coverage Δ
ixmp/reporting/quantity.py 93.33% <92.30%> (-1.67%) ⬇️
ixmp/reporting/attrseries.py 99.01% <99.01%> (ø)
ixmp/cli.py 98.70% <100.00%> (ø)
ixmp/reporting/__init__.py 95.07% <100.00%> (ø)
ixmp/reporting/computations.py 98.81% <100.00%> (+1.38%) ⬆️
ixmp/reporting/sparsedataarray.py 100.00% <100.00%> (ø)
ixmp/reporting/testing.py 100.00% <100.00%> (ø)
ixmp/reporting/utils.py 95.83% <100.00%> (ø)
ixmp/testing.py 73.56% <100.00%> (-1.44%) ⬇️
ixmp/tests/reporting/__init__.py 100.00% <100.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7d7a6cb...28d59ae. Read the comment docs.

@khaeru khaeru force-pushed the issue/191 branch 2 times, most recently from d5d944d to 664540e Compare April 30, 2020 13:53
@khaeru khaeru force-pushed the issue/191 branch 4 times, most recently from 63f0fe3 to 5226ae6 Compare June 9, 2020 12:37
@khaeru khaeru changed the title Use sparse xarray for reporting.Quantity Generalize reporting.Quantity in preparation for sparse xarray Jun 19, 2020
khaeru added a commit to khaeru/message_ix that referenced this pull request Jun 19, 2020
khaeru added a commit to khaeru/message_ix that referenced this pull request Jun 19, 2020
@khaeru khaeru mentioned this pull request Jun 19, 2020
3 tasks
khaeru added a commit to khaeru/ixmp that referenced this pull request Jun 19, 2020
@khaeru khaeru merged commit 9785f37 into iiasa:master Jun 19, 2020
@khaeru khaeru deleted the issue/191 branch June 19, 2020 22:32
khaeru added a commit to khaeru/message_ix that referenced this pull request Jun 20, 2020
khaeru added a commit to khaeru/message_ix that referenced this pull request Jun 20, 2020
khaeru added a commit to khaeru/message_ix that referenced this pull request Jun 20, 2020
khaeru added a commit to khaeru/message_ix that referenced this pull request Jun 20, 2020
khaeru added a commit to khaeru/message_ix that referenced this pull request Jun 20, 2020
khaeru added a commit to iiasa/message_ix that referenced this pull request Jun 20, 2020
khaeru added a commit to khaeru/genno that referenced this pull request Jan 11, 2021
khaeru added a commit to khaeru/genno that referenced this pull request Jan 11, 2021
khaeru added a commit to khaeru/genno that referenced this pull request Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reporting Post-processing of model results
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant