Skip to content

Improve IAMCConversion#456

Draft
khaeru wants to merge 18 commits intomainfrom
issue/454
Draft

Improve IAMCConversion#456
khaeru wants to merge 18 commits intomainfrom
issue/454

Conversation

@khaeru
Copy link
Copy Markdown
Member

@khaeru khaeru commented Nov 12, 2025

Closes #454.

How to review

TBA

PR checklist

  • Continuous integration checks all ✅
  • Add or expand tests; coverage checks both ✅
  • Add, expand, or update documentation.
  • Update doc/whatsnew.

@khaeru khaeru self-assigned this Nov 12, 2025
@khaeru khaeru added enh New features or functionality report genno-based reporting and post-solve processing labels Nov 12, 2025


@cache
def get_technology_groups() -> dict[Literal["t"], dict[str, list[str]]]:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprisingly found that input c + l and output c + l are not enough to describe a group of technologies in the current version.

I tried to use it to get a group of "fossil power generation" technologies, which worked well.
Then I moved on to "solar power generation" technologies. I found that the solar_res_*s in the current model version do not use input at all, and they are also not the only technologies that do not use input (also winds).

Maybe it is not a bad idea to add dummy commodity input or real ones (to get proper Primary Energy|Solar).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that the solar_res_*s in the current model version do not use input at all, and they are also not the only technologies that do not use input (also winds).

Maybe it is not a bad idea to add dummy commodity input or real ones (to get proper Primary Energy|Solar).

That could be one way to do it.

Other options—not necessarily mutually exclusive:

  1. Add function(s) that call get_technology_groups() and then further process the return values to add, modify, remove, combine, etc. So for instance, one could take one of the lists and filter only entries like name.startswith("solar_res") or similar.
  2. Add extra "annotations" and to technology.yaml:
    solar_res1:
      name: solar_res1
      description: Maximum solar electricity potential 1
      type: secondary
      sector: electricity
      output: [electr, secondary]
      groups: ["solar res", "foo", "bar"]
    …and improve get_technology_groups() to add such tech IDs to the named groups.
  3. Add extra 'parent' technologies with 'children' to technology.yaml:
    SOLAR RES:
      name: Group of all solar potential technologies
      child: [solar_res1, solar_res2, ...]
    (This is done in the transport technology.yaml, for instance here, but not yet in the 'main' one.)
    get_technology_groups() can then understand that "SOLAR RES" should not be added to the Scenario's technology set, but should be interpreted as/included in the list of groups.

In the case of (2), (3), and the "dummy" inputs, the information still lives in the YAML file; in (1) the information is produced by code. So I would prefer the former for that reason.

Can you give any example(s) (1 or more) of groups of technologies that need to be available? I can add them to the tests and then make sure that the code can produce them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks. The 2 and 3 make quite much sense. We should avoid making gdx bigger indeed.
I was basically going through the technology groups sitting in lhs/rhs here.

https://github.com/iiasa/message_data/blob/dev/data/policies/default_config.yaml#L810-L881

Will come back with examples once I finish.

khaeru added 18 commits April 29, 2026 10:47
- Add optional rename=… argument.
- Add only sums needed for conversion, not all possible sums.
- Adjust logic for dimension renames:
  - Infer dimensions to rename from var_parts.
  - Don't mix defaults and explicit/user-supplied values.
  - Validate resulting arg.
Chain directly to IAMCConversion.{__init__,add_tasks}.
- Add keys "all::iamc+csv", "all::iamc+xlsx", etc. to defaults.
…invoking get_technology_groups()
- Preserve same units as input quantity.
- Drop dimensions if they would be dropped by select(), given the
  indexers.
This ensures "all::iamc" is created, if it does not already exist.
- Replace reporting of GDP to IAMC structure in report/global.yaml.
- Add to default .report.Config.callback.
- Replace reporting of prices to IAMC structure in report/global.yaml.
- Add to default .report.Config.callback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enh New features or functionality report genno-based reporting and post-solve processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle quantities with 2+ n/y dims in IAMCConversion

2 participants