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 generic Aggregator processor #462

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

danielhuppmann
Copy link
Member

@danielhuppmann danielhuppmann commented Jan 22, 2025

This PR is in relation to a request by @jkikstra for a CEDS-emissions-processor that renames and aggregates emissions-variables from IAM results to match the CEDS schema - see the related PR at IAMconsortium/common-definitions#255

The idea is to have a mapping like

- Target Code:
    - Variable A
    - Variable B

that can then be called like

ceds_mapping = AggregationMapping.from_yaml("ceds-mapping/ceds-variable-mapping.yaml")
ceds_aggregator = Aggregator(dimension="variable", mapping=ceds_mapping)

ceds_aggregator.apply(df)

to apply the aggregation-mapping onto an IamDataFrame df.

The method uses the pyam rename() method because that actually works (with summation) on all dimensions. This could be extended later for different aggregation-methods, etc.

This could be useful for @lisahligono as part of the scenario-transfer-routine, where the rename-mapping for regions is implemented as an external yaml file and then just called like shown above as part of the processing-and-transfer.

@danielhuppmann
Copy link
Member Author

Yes, I will still add tests but wanted to hear any comments about feature-design first...

@phackstock
Copy link
Contributor

As per bilateral discussion, I'd say this is a good way forward.
I'd include the dimension attribute in the yaml file.

@dc-almeida
Copy link
Collaborator

Makes sense to me!

@danielhuppmann danielhuppmann force-pushed the feature/generic-aggregator branch from bf621cb to 2e9a6c5 Compare February 7, 2025 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants