update industry to new JRC-idees

This commit is contained in:
lisazeyen 2024-07-29 15:39:01 +02:00
parent c99cd72727
commit 201889424c
4 changed files with 44 additions and 38 deletions

View File

@ -716,7 +716,7 @@ industry:
MWh_CH4_per_tMeOH: 10.25 MWh_CH4_per_tMeOH: 10.25
MWh_MeOH_per_tMeOH: 5.528 MWh_MeOH_per_tMeOH: 5.528
hotmaps_locate_missing: false hotmaps_locate_missing: false
reference_year: 2015 reference_year: 2021
# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#costs # docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#costs

View File

@ -509,7 +509,7 @@ rule build_industrial_production_per_country:
countries=config_provider("countries"), countries=config_provider("countries"),
input: input:
ammonia_production=resources("ammonia_production.csv"), ammonia_production=resources("ammonia_production.csv"),
jrc="data/bundle/jrc-idees-2015", jrc="data/bundle/jrc-idees-2021",
eurostat="data/eurostat/Balances-April2023", eurostat="data/eurostat/Balances-April2023",
output: output:
industrial_production_per_country=resources( industrial_production_per_country=resources(
@ -656,7 +656,7 @@ rule build_industrial_energy_demand_per_country_today:
countries=config_provider("countries"), countries=config_provider("countries"),
industry=config_provider("industry"), industry=config_provider("industry"),
input: input:
jrc="data/bundle/jrc-idees-2015", jrc="data/bundle/jrc-idees-2021",
industrial_production_per_country=resources( industrial_production_per_country=resources(
"industrial_production_per_country.csv" "industrial_production_per_country.csv"
), ),

View File

@ -8,7 +8,7 @@ Build industrial energy demand per country.
Inputs Inputs
------- -------
- ``data/bundle/jrc-idees-2015`` - ``data/bundle/jrc-idees-2021``
- ``industrial_production_per_country.csv`` - ``industrial_production_per_country.csv``
Outputs Outputs
@ -120,7 +120,7 @@ jrc_names = {"GR": "EL", "GB": "UK"}
def industrial_energy_demand_per_country(country, year, jrc_dir): def industrial_energy_demand_per_country(country, year, jrc_dir):
jrc_country = jrc_names.get(country, country) jrc_country = jrc_names.get(country, country)
fn = f"{jrc_dir}/JRC-IDEES-2015_EnergyBalance_{jrc_country}.xlsx" fn = f"{jrc_dir}/{jrc_country}/JRC-IDEES-2021_EnergyBalance_{jrc_country}.xlsx"
sheets = list(sector_sheets.values()) sheets = list(sector_sheets.values())
df_dict = pd.read_excel(fn, sheet_name=sheets, index_col=0) df_dict = pd.read_excel(fn, sheet_name=sheets, index_col=0)

View File

@ -16,7 +16,7 @@ Relevant Settings
Inputs Inputs
------- -------
- ``resources/ammonia_production.csv`` - ``resources/ammonia_production.csv``
- ``data/bundle-sector/jrc-idees-2015`` - ``data/bundle-sector/jrc-idees-2021``
- ``data/eurostat`` - ``data/eurostat``
Outputs Outputs
@ -50,11 +50,11 @@ The following subcategories [kton/a] are considered:
- Aluminium - primary production - Aluminium - primary production
- Aluminium - secondary production - Aluminium - secondary production
- Other non-ferrous metals - Other non-ferrous metals
- Transport Equipment - Transport equipment
- Machinery Equipment - Machinery equipment
- Textiles and leather - Textiles and leather
- Wood and wood products - Wood and wood products
- Other Industrial Sectors - Other industrial sectors
- Ammonia - Ammonia
- HVC - HVC
- Chlorine - Chlorine
@ -79,25 +79,25 @@ ktoe_to_twh = 0.01163
sub_sheet_name_dict = { sub_sheet_name_dict = {
"Iron and steel": "ISI", "Iron and steel": "ISI",
"Chemicals Industry": "CHI", "Chemical industry": "CHI",
"Non-metallic mineral products": "NMM", "Non-metallic mineral products": "NMM",
"Pulp, paper and printing": "PPA", "Pulp, paper and printing": "PPA",
"Food, beverages and tobacco": "FBT", "Food, beverages and tobacco": "FBT",
"Non Ferrous Metals": "NFM", "Non Ferrous Metals": "NFM",
"Transport Equipment": "TRE", "Transport equipment": "TRE",
"Machinery Equipment": "MAE", "Machinery equipment": "MAE",
"Textiles and leather": "TEL", "Textiles and leather": "TEL",
"Wood and wood products": "WWP", "Wood and wood products": "WWP",
"Other Industrial Sectors": "OIS", "Other industrial sectors": "OIS",
} }
eu28 = cc.EU28as("ISO2").ISO2.values eu27 = cc.EU27as("ISO2").ISO2.values
jrc_names = {"GR": "EL", "GB": "UK"} jrc_names = {"GR": "EL", "GB": "UK"}
sect2sub = { sect2sub = {
"Iron and steel": ["Electric arc", "Integrated steelworks"], "Iron and steel": ["Electric arc", "Integrated steelworks"],
"Chemicals Industry": [ "Chemical industry": [
"Basic chemicals", "Basic chemicals",
"Other chemicals", "Other chemicals",
"Pharmaceutical products etc.", "Pharmaceutical products etc.",
@ -119,11 +119,11 @@ sect2sub = {
"Aluminium - secondary production", "Aluminium - secondary production",
"Other non-ferrous metals", "Other non-ferrous metals",
], ],
"Transport Equipment": ["Transport Equipment"], "Transport equipment": ["Transport equipment"],
"Machinery Equipment": ["Machinery Equipment"], "Machinery equipment": ["Machinery equipment"],
"Textiles and leather": ["Textiles and leather"], "Textiles and leather": ["Textiles and leather"],
"Wood and wood products": ["Wood and wood products"], "Wood and wood products": ["Wood and wood products"],
"Other Industrial Sectors": ["Other Industrial Sectors"], "Other industrial sectors": ["Other industrial sectors"],
} }
sub2sect = {v: k for k, vv in sect2sub.items() for v in vv} sub2sect = {v: k for k, vv in sect2sub.items() for v in vv}
@ -145,27 +145,29 @@ fields = {
"Aluminium - primary production": "Aluminium - primary production", "Aluminium - primary production": "Aluminium - primary production",
"Aluminium - secondary production": "Aluminium - secondary production", "Aluminium - secondary production": "Aluminium - secondary production",
"Other non-ferrous metals": "Other non-ferrous metals (kt lead eq.)", "Other non-ferrous metals": "Other non-ferrous metals (kt lead eq.)",
"Transport Equipment": "Physical output (index)", "Transport equipment": "Physical output (index)",
"Machinery Equipment": "Physical output (index)", "Machinery equipment": "Physical output (index)",
"Textiles and leather": "Physical output (index)", "Textiles and leather": "Physical output (index)",
"Wood and wood products": "Physical output (index)", "Wood and wood products": "Physical output (index)",
"Other Industrial Sectors": "Physical output (index)", "Other industrial sectors": "Physical output (index)",
} }
eb_sectors = { eb_sectors = {
"Iron & steel": "Iron and steel", "Iron & steel": "Iron and steel",
"Chemical & petrochemical": "Chemicals Industry", "Chemical & petrochemical": "Chemical industry",
"Non-ferrous metals": "Non-metallic mineral products", "Non-ferrous metals": "Non-metallic mineral products",
"Paper, pulp & printing": "Pulp, paper and printing", "Paper, pulp & printing": "Pulp, paper and printing",
"Food, beverages & tobacco": "Food, beverages and tobacco", "Food, beverages & tobacco": "Food, beverages and tobacco",
"Non-metallic minerals": "Non Ferrous Metals", "Non-metallic minerals": "Non Ferrous Metals",
"Transport equipment": "Transport Equipment", "Transport equipment": "Transport equipment",
"Machinery": "Machinery Equipment", "Machinery": "Machinery equipment",
"Textile & leather": "Textiles and leather", "Textile & leather": "Textiles and leather",
"Wood & wood products": "Wood and wood products", "Wood & wood products": "Wood and wood products",
"Not elsewhere specified (industry)": "Other Industrial Sectors", "Not elsewhere specified (industry)": "Other industrial sectors",
} }
# TODO: this should go in a csv in `data` # TODO: this should go in a csv in `data`
# Annual energy consumption in Switzerland by sector in 2015 (in TJ) # Annual energy consumption in Switzerland by sector in 2015 (in TJ)
# From: Energieverbrauch in der Industrie und im Dienstleistungssektor, Der Bundesrat # From: Energieverbrauch in der Industrie und im Dienstleistungssektor, Der Bundesrat
@ -173,16 +175,16 @@ eb_sectors = {
e_switzerland = pd.Series( e_switzerland = pd.Series(
{ {
"Iron and steel": 7889.0, "Iron and steel": 7889.0,
"Chemicals Industry": 26871.0, "Chemical industry": 26871.0,
"Non-metallic mineral products": 15513.0 + 3820.0, "Non-metallic mineral products": 15513.0 + 3820.0,
"Pulp, paper and printing": 12004.0, "Pulp, paper and printing": 12004.0,
"Food, beverages and tobacco": 17728.0, "Food, beverages and tobacco": 17728.0,
"Non Ferrous Metals": 3037.0, "Non Ferrous Metals": 3037.0,
"Transport Equipment": 14993.0, "Transport equipment": 14993.0,
"Machinery Equipment": 4724.0, "Machinery equipment": 4724.0,
"Textiles and leather": 1742.0, "Textiles and leather": 1742.0,
"Wood and wood products": 0.0, "Wood and wood products": 0.0,
"Other Industrial Sectors": 10825.0, "Other industrial sectors": 10825.0,
"current electricity": 53760.0, "current electricity": 53760.0,
} }
) )
@ -199,8 +201,12 @@ def get_energy_ratio(country, eurostat_dir, jrc_dir, year):
if country == "CH": if country == "CH":
e_country = e_switzerland * tj_to_ktoe e_country = e_switzerland * tj_to_ktoe
else: else:
ct_eurostat = country.replace("GB","UK")
if ct_eurostat == "UK":
year=2019
logger.info("Assume Eurostat data for GB from 2019.")
# estimate physical output, energy consumption in the sector and country # estimate physical output, energy consumption in the sector and country
fn = f"{eurostat_dir}/{country}-Energy-balance-sheets-April-2023-edition.xlsb" fn = f"{eurostat_dir}/{ct_eurostat}-Energy-balance-sheets-April-2023-edition.xlsb"
df = pd.read_excel( df = pd.read_excel(
fn, fn,
sheet_name=str(min(2021, year)), sheet_name=str(min(2021, year)),
@ -210,19 +216,19 @@ def get_energy_ratio(country, eurostat_dir, jrc_dir, year):
) )
e_country = df.loc[eb_sectors.keys(), "Total"].rename(eb_sectors) e_country = df.loc[eb_sectors.keys(), "Total"].rename(eb_sectors)
fn = f"{jrc_dir}/JRC-IDEES-2015_Industry_EU28.xlsx" fn = f"{jrc_dir}/EU27/JRC-IDEES-2021_Industry_EU27.xlsx"
with mute_print(): with mute_print():
df = pd.read_excel(fn, sheet_name="Ind_Summary", index_col=0, header=0).squeeze( df = pd.read_excel(fn, sheet_name="Ind_Summary", index_col=0, header=0).squeeze(
"columns" "columns"
) )
assert df.index[48] == "by sector" assert df.index[49] == "by sector"
year_i = df.columns.get_loc(year) year_i = df.columns.get_loc(year)
e_eu28 = df.iloc[49:76, year_i] e_eu27 = df.iloc[50:77, year_i]
e_eu28.index = e_eu28.index.str.lstrip() e_eu27.index = e_eu27.index.str.lstrip()
e_ratio = e_country / e_eu28 e_ratio = e_country / e_eu27
return pd.Series({k: e_ratio[v] for k, v in sub2sect.items()}) return pd.Series({k: e_ratio[v] for k, v in sub2sect.items()})
@ -230,7 +236,7 @@ def get_energy_ratio(country, eurostat_dir, jrc_dir, year):
def industry_production_per_country(country, year, eurostat_dir, jrc_dir): def industry_production_per_country(country, year, eurostat_dir, jrc_dir):
def get_sector_data(sector, country): def get_sector_data(sector, country):
jrc_country = jrc_names.get(country, country) jrc_country = jrc_names.get(country, country)
fn = f"{jrc_dir}/JRC-IDEES-2015_Industry_{jrc_country}.xlsx" fn = f"{jrc_dir}/{jrc_country}/JRC-IDEES-2021_Industry_{jrc_country}.xlsx"
sheet = sub_sheet_name_dict[sector] sheet = sub_sheet_name_dict[sector]
with mute_print(): with mute_print():
df = pd.read_excel(fn, sheet_name=sheet, index_col=0, header=0).squeeze( df = pd.read_excel(fn, sheet_name=sheet, index_col=0, header=0).squeeze(
@ -245,10 +251,10 @@ def industry_production_per_country(country, year, eurostat_dir, jrc_dir):
return df return df
ct = "EU28" if country not in eu28 else country ct = "EU27" if country not in eu27 else country
demand = pd.concat([get_sector_data(s, ct) for s in sect2sub]) demand = pd.concat([get_sector_data(s, ct) for s in sect2sub])
if country not in eu28: if country not in eu27:
demand *= get_energy_ratio(country, eurostat_dir, jrc_dir, year) demand *= get_energy_ratio(country, eurostat_dir, jrc_dir, year)
demand.name = country demand.name = country