From 19709420030d37d7f7f8a8235e12e160f0c224c6 Mon Sep 17 00:00:00 2001 From: maartenbrinkerink <65602545+maartenbrinkerink@users.noreply.github.com> Date: Wed, 11 Dec 2024 12:10:28 -0500 Subject: [PATCH] gen shares adjustments for headline metrics --- .../scripts/osemosys_global/summary/headline.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/workflow/scripts/osemosys_global/summary/headline.py b/workflow/scripts/osemosys_global/summary/headline.py index e4bb810..f8b70d0 100644 --- a/workflow/scripts/osemosys_global/summary/headline.py +++ b/workflow/scripts/osemosys_global/summary/headline.py @@ -52,6 +52,7 @@ def _filter_pwr_techs( """ df = production_by_technology.copy() + df = df.loc[df.index.get_level_values("FUEL").str.startswith('ELC')] df = df[ (df.index.get_level_values("TECHNOLOGY").str.startswith("PWR")) @@ -71,6 +72,7 @@ def _filter_techs( ) -> pd.DataFrame: df = production_by_technology.copy() + df = df.loc[df.index.get_level_values("FUEL").str.startswith('ELC')] df["tech"] = df.index.get_level_values("TECHNOLOGY").str[0:6] techs = [f"PWR{x}" for x in carriers] @@ -83,11 +85,14 @@ def _filter_techs( def get_gen_shares( production_by_technology: pd.DataFrame, exclusions: Optional[list[str]] = None ) -> pd.DataFrame: + + df = production_by_technology.copy() + df = df.loc[df.index.get_level_values("FUEL").str.startswith('ELC')] - gen_total = _filter_pwr_techs(production_by_technology, exclusions).VALUE.sum() - rnw_total = _filter_techs(production_by_technology, RENEWABLES).VALUE.sum() - fsl_total = _filter_techs(production_by_technology, FOSSIL).VALUE.sum() - cln_total = _filter_techs(production_by_technology, CLEAN).VALUE.sum() + gen_total = _filter_pwr_techs(df, exclusions).VALUE.sum() + rnw_total = _filter_techs(df, RENEWABLES).VALUE.sum() + fsl_total = _filter_techs(df, FOSSIL).VALUE.sum() + cln_total = _filter_techs(df, CLEAN).VALUE.sum() rnw_share = round((rnw_total / gen_total) * 100, 0) fsl_share = round((fsl_total / gen_total) * 100, 0)