From cfafcf889398bdb38d170f1c3e9fcf22c5f8e323 Mon Sep 17 00:00:00 2001 From: Paul Natsuo Kishimoto Date: Fri, 19 Apr 2024 22:36:26 +0200 Subject: [PATCH] Add general report key "all::iamc" --- message_ix_models/report/__init__.py | 3 +++ message_ix_models/report/compat.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/message_ix_models/report/__init__.py b/message_ix_models/report/__init__.py index 1af57e7d9d..0e5ddb264d 100644 --- a/message_ix_models/report/__init__.py +++ b/message_ix_models/report/__init__.py @@ -369,6 +369,9 @@ def prepare_reporter( ) rep.configure(model=deepcopy(context.model)) + # Add a placeholder task to concatenate IAMC-structured data + rep.add("all::iamc", "concat") + # Apply callbacks for other modules which define additional reporting computations for callback in chain(CALLBACKS, context.report.iter_callbacks()): callback(rep, context) diff --git a/message_ix_models/report/compat.py b/message_ix_models/report/compat.py index 9e0d198b1b..8690a5e030 100644 --- a/message_ix_models/report/compat.py +++ b/message_ix_models/report/compat.py @@ -416,6 +416,10 @@ def full(name: str) -> Key: info = dict(variable="transport emissions", base=k1.drop("h", "m", "yv"), var=[var]) iamc(rep, info) + # Append to the "all::iamc" task + # TODO Use a helper function for this + rep.graph["all::iamc"] += ("transport emissions::iamc",) + # TODO use store_ts() to store on scenario log.info(f"Added {len(rep.graph) - N} keys")