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 .tools.graph_viz_tool #906

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Add .tools.graph_viz_tool #906

wants to merge 1 commit into from

Conversation

macflo8
Copy link

@macflo8 macflo8 commented Jan 10, 2025

Following on the 2024-12-12 MESSAGE meeting and #580, this PR aims to add a tool that can visualise a MESSAGEix model structure as a graph.

The initial commit adds the standalone tool developed by @macflo8, which can serve as a basis for a tool that is fully integrated in the message_ix code base. The standalone tool offers two visualisation options:

How to review

  • The general methodology should be reviewed to make sure the tool is computationally efficient.
  • The design should be reviewed to make sure it fits with the patterns used in message_ix.
  • The ease of use should be reviewed, to increase the probability that current (and future) message_ix users will actually use it.

PR checklist

  • Continuous integration checks all ✅
  • Add or expand tests; coverage checks both ✅
  • Add, expand, or update documentation.
  • Update release notes.

@macflo8 macflo8 added the enh New features & functionality label Jan 10, 2025
@CLAassistant
Copy link

CLAassistant commented Jan 10, 2025

CLA assistant check
All committers have signed the CLA.

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.6%. Comparing base (59f3d82) to head (26303c0).

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #906   +/-   ##
=====================================
  Coverage   95.6%   95.6%           
=====================================
  Files         48      48           
  Lines       4394    4394           
=====================================
  Hits        4204    4204           
  Misses       190     190           

@khaeru
Copy link
Member

khaeru commented Jan 10, 2025

Thanks! Let's work together on this branch to address the TODOs from the description.

Some thoughts before jumping in:

  1. At the 2025-01-09 MESSAGE team meeting, @OFR-IIASA reminded of a suite of checks that he and @gidden developed for common issues in constructing MESSAGEix models. I mentioned Add .tools.check() #506, still a draft. One of the examples we discussed was the case where there is (potentially) input from/output to a (level, commodity, node, time) that does not have a corresponding source/sink. (This is not necessarily an error, as some such technologies may never need to be active.) This check can be implemented by inspection of the same abstract graph data structure that is used here to make a graphical visualization.
  2. In Add .tools.sankey and tutorial #770, the data used is a similar abstract graph, except a weighted graph where the edge weights are the magnitudes of the respective flows. There it is expressed in the IAMC structure particular to pyam.
  3. As revealed by Add .tools.sankey and tutorial #770, the RES structure can potentially differ by MESSAGE node and year (period). (This is potentially confusing as a modeling practice, thus discouraged, but the framework does not prevent it.) So we may need to provide similar options here, e.g. select one (node, year) or sum across many.
  4. We should be careful in documentation (comments, docstrings, docs, files) to distinguish the "MESSAGE node [set/dimension]" from a "graph node", the common mathematical concept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enh New features & functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants