Skip to content

Commit

Permalink
Tolerate missing labels in MappingAdapter.adapt
Browse files Browse the repository at this point in the history
  • Loading branch information
khaeru authored and GamzeUnlu95 committed Dec 4, 2024
1 parent 63ddb71 commit 8162acd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions message_ix_models/util/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ def adapt(self, qty: Quantity) -> Quantity:
continue
result = concat(
*[
qty.sel({dim: label[0]}, drop=True).expand_dims({dim: [label[1]]})
for label in labels
qty.sel({dim: a}, drop=True).expand_dims({dim: [b]})
for (a, b) in labels
if a in qty.coords[dim] # Skip `label` if not in `dim` of `qty`
]
)

Expand Down

0 comments on commit 8162acd

Please sign in to comment.