From db297cfc43c7f73b8ad41ea33b75b7279fef9e59 Mon Sep 17 00:00:00 2001 From: Fridolin Glatter Date: Tue, 10 Sep 2024 14:30:18 +0200 Subject: [PATCH] Handle KeyError in cooling_fr to avoid minimum version tag --- message_ix_models/model/water/data/water_for_ppl.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/message_ix_models/model/water/data/water_for_ppl.py b/message_ix_models/model/water/data/water_for_ppl.py index 50504ec5e2..bdea1eb7e2 100644 --- a/message_ix_models/model/water/data/water_for_ppl.py +++ b/message_ix_models/model/water/data/water_for_ppl.py @@ -54,9 +54,12 @@ def cooling_fr(x: pd.Series) -> float: where: h_fg (flue gasses losses) = 0.1 (10% assumed losses) """ - if "hpl" in x["parent_tech"]: - return x["value"] - 1 - else: + try: + if "hpl" in x["parent_tech"]: + return x["value"] - 1 + else: + return x["value"] - (x["value"] * 0.1) - 1 + except KeyError: return x["value"] - (x["value"] * 0.1) - 1