Skip to content

Commit

Permalink
Fix issue of CC for cement
Browse files Browse the repository at this point in the history
Fix issue with efficiency rates for cement
Version bump
  • Loading branch information
romainsacchi committed Oct 7, 2023
1 parent cfcd577 commit 500964e
Show file tree
Hide file tree
Showing 6 changed files with 509 additions and 42 deletions.
529 changes: 494 additions & 35 deletions dev/test_custom_scenarios.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion premise/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__all__ = ("NewDatabase", "clear_cache", "get_regions_definition")
__version__ = (1, 7, 3)
__version__ = (1, 7, 4)

from pathlib import Path

Expand Down
2 changes: 1 addition & 1 deletion premise/cement.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def build_clinker_production_datasets(self) -> Dict[str, dict]:

# Carbon capture rate: share of capture of total CO2 emitted
carbon_capture_rate = self.get_carbon_capture_rate(
loc=dataset["location"], sector="cement, dry feed rotary kiln"
loc=dataset["location"], sector="cement"
)

dataset["log parameters"].update(
Expand Down
13 changes: 10 additions & 3 deletions premise/data_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ def __init__(
self.electricity_efficiencies = self.get_iam_efficiencies(
data=data, efficiency_labels=electricity_eff_vars
)

self.cement_efficiencies = self.get_iam_efficiencies(
data=data,
efficiency_labels=cement_eff_vars,
Expand Down Expand Up @@ -713,8 +714,6 @@ def __get_iam_data(
x.lower() if isinstance(x, str) else x for x in dataframe.columns
]

# print(dataframe["variable"].unique())

dataframe = dataframe.loc[dataframe["variable"].isin(variables)]

dataframe = dataframe.rename(columns={"variable": "variables"})
Expand Down Expand Up @@ -857,7 +856,7 @@ def get_iam_efficiencies(
all(var in data.variables.values for var in energy_labels[k])
and v in data.variables.values
):
d = 1 / (
d = (
data.loc[:, energy_labels[k], :].sum(dim="variables")
/ data.loc[:, v, :]
)
Expand All @@ -872,9 +871,17 @@ def get_iam_efficiencies(
return None

if not self.use_absolute_efficiency:
# efficiency expressed
eff_data /= eff_data.sel(year=2020)

if len(efficiency_labels) == 0 or any("specific" in x.lower() for x in efficiency_labels.values()):
# we are dealing with specific energy consumption, not efficiencies
# we need to convert them to efficiencies
eff_data = 1 / eff_data

# fix efficiencies
eff_data = fix_efficiencies(eff_data, self.min_year)

else:
# if absolute efficiencies are used, we need to make sure that
# the efficiency is not greater than 1
Expand Down
3 changes: 2 additions & 1 deletion premise/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ def generate_summary_report(scenarios: list, filename: Path) -> None:
variables = get_variables(filepath["filepath"])
if "filter" in filepath:
variables = [
x for x in variables if any(y in x for y in filepath["filter"])
x for x in variables
if any(y in x for y in filepath["filter"])
]

worksheet = workbook.create_sheet(sector)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def package_files(directory):

setup(
name="premise",
version="1.7.3",
version="1.7.4",
python_requires=">=3.9,<3.11",
packages=packages,
author="Romain Sacchi <[email protected]>, Alois Dirnaichner <[email protected]>, Chris Mutel "
Expand Down

0 comments on commit 500964e

Please sign in to comment.