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

Add .report.key #831

Open
khaeru opened this issue Apr 22, 2024 · 0 comments
Open

Add .report.key #831

khaeru opened this issue Apr 22, 2024 · 0 comments
Labels
enh New features & functionality reporting

Comments

@khaeru
Copy link
Member

khaeru commented Apr 22, 2024

In message_data.model.transport, we have a submodule .key that does nothing more than define a list of genno.Key. This makes it easier to prepare reporting calculations.

By analogy, add message_ix.report.key with full-dimensionality keys for every set, parameter, and variable available in a message_ix.Scenario via message_ix.Reporter. So for instance instead of this:

from message_ix import Reporter, Scenario

scen, mp = Scenario.from_url("…")
rep = Reporter.from_scenario(scen)

####

from genno import Key

# Operate on full-dimensionality `input` summed on `time`, `time_origin`
k = Key("input", "nl t yv ya m no c l h ho".split())
rep.add("check", "my_operator", k / ("h", "ho"), ...)

…a user could do this:

from message_ix.report.key import input

rep.add("check", "my_operator", input / ("h", "ho"), ...)

This essentially saves having to look up, retype, or use rep.full_key() to get the full dimensionality.

@khaeru khaeru added enh New features & functionality reporting labels Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enh New features & functionality reporting
Projects
None yet
Development

No branches or pull requests

1 participant