Skip to content

Commit

Permalink
Making aggregation compatible with pyam 2.1 (#322)
Browse files Browse the repository at this point in the history
* Update to pyam 2.1

* Adjust aggregation for pyam 2.1

* Apply suggestions from code review

Co-authored-by: Daniel Huppmann <dh@dergelbesalon.at>

---------

Co-authored-by: Daniel Huppmann <dh@dergelbesalon.at>
  • Loading branch information
phackstock and danielhuppmann authored Feb 9, 2024
1 parent f4627d9 commit 637b8ac
Show file tree
Hide file tree
Showing 3 changed files with 739 additions and 750 deletions.
7 changes: 5 additions & 2 deletions nomenclature/processor/region.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,12 @@ def _aggregate_region(df, var, *regions, **kwargs):
try:
return df.aggregate_region(var, *regions, **kwargs)
except ValueError as error:
if str(error) == "Inconsistent index between variable and weight!":
if str(error).startswith("Missing weights for the following data"):
logger.info(
f"Could not aggregate '{var}' for region '{regions[0]}' ({kwargs})"
(
f"Could not aggregate '{var}' for region '{regions[0]}' "
f"({kwargs})\n{error}"
)
)
else:
raise error
Expand Down
Loading

0 comments on commit 637b8ac

Please sign in to comment.