Skip to content

Commit ef7b7f1

Browse files
authored
Improve warning message (#570)
* Improve warning message * Improve wording
1 parent 35b4ecd commit ef7b7f1

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/muse/mca.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,13 +565,17 @@ def check_demand_fulfillment(market: Dataset, tol: float) -> bool:
565565
"""
566566
from logging import getLogger
567567

568-
future = market.year[-1]
568+
future = market.year[-1].item()
569569
delta = (market.supply - market.consumption).sel(year=future)
570570
unmet = (delta < tol).any([u for u in delta.dims if u != "commodity"])
571571

572572
if unmet.any():
573573
commodities = ", ".join(unmet.commodity.sel(commodity=unmet.values).values)
574-
getLogger(__name__).warning(f"Check growth constraints for {commodities}.")
574+
msg = (
575+
f"Consumption exceeds supply in the year {future} for the following "
576+
f"commodities: {commodities} "
577+
)
578+
getLogger(__name__).warning(msg)
575579

576580
return False
577581

0 commit comments

Comments
 (0)