From ef7b7f11d4b57ce2186b060526c90a1652fbcda1 Mon Sep 17 00:00:00 2001 From: Tom Bland Date: Tue, 19 Nov 2024 15:12:54 +0000 Subject: [PATCH] Improve warning message (#570) * Improve warning message * Improve wording --- src/muse/mca.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/muse/mca.py b/src/muse/mca.py index 0ece5eba..0a581df3 100644 --- a/src/muse/mca.py +++ b/src/muse/mca.py @@ -565,13 +565,17 @@ def check_demand_fulfillment(market: Dataset, tol: float) -> bool: """ from logging import getLogger - future = market.year[-1] + future = market.year[-1].item() delta = (market.supply - market.consumption).sel(year=future) unmet = (delta < tol).any([u for u in delta.dims if u != "commodity"]) if unmet.any(): commodities = ", ".join(unmet.commodity.sel(commodity=unmet.values).values) - getLogger(__name__).warning(f"Check growth constraints for {commodities}.") + msg = ( + f"Consumption exceeds supply in the year {future} for the following " + f"commodities: {commodities} " + ) + getLogger(__name__).warning(msg) return False