* Cluster first: build renewable profiles and add all assets after clustering * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * correction: pass landfall_lengths through functions * assign landfall_lenghts correctly * remove parameter add_land_use_constraint * fix network_dict * calculate distance to shoreline, remove underwater_fraction * adjust simplification parameter to exclude Crete from offshore wind connections * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * remove unused geth2015 hydro capacities * removing remaining traces of {simpl} wildcard * add release notes and update workflow graphics * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: lisazeyen <lisa.zeyen@web.de>
94 lines
3.1 KiB
Python
94 lines
3.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
# SPDX-FileCopyrightText: : 2020-2024 The PyPSA-Eur Authors
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
"""
|
|
Build industrial production per model region.
|
|
|
|
Inputs
|
|
-------
|
|
|
|
- ``resources/industrial_distribution_key_base_s_{clusters}.csv``
|
|
- ``resources/industrial_production_per_country_tomorrow_{planning_horizons}.csv``
|
|
|
|
Outputs
|
|
-------
|
|
|
|
- ``resources/industrial_production_per_node_base_s_{clusters}_{planning_horizons}.csv``
|
|
|
|
Description
|
|
-------
|
|
|
|
This rule maps the industrial production per country from a certain time horizon to each bus region.
|
|
The mapping file provides a value between 0 and 1 for each bus and industry subcategory, indicating the share of the country's production of that sector in that bus.
|
|
The industrial production per country is multiplied by the mapping value to get the industrial production per bus.
|
|
The unit of the production is kt/a.
|
|
"""
|
|
|
|
from itertools import product
|
|
|
|
import pandas as pd
|
|
from _helpers import set_scenario_config
|
|
|
|
# map JRC/our sectors to hotmaps sector, where mapping exist
|
|
sector_mapping = {
|
|
"Electric arc": "EAF",
|
|
"Integrated steelworks": "Integrated steelworks",
|
|
"DRI + Electric arc": "DRI + EAF",
|
|
"Ammonia": "Ammonia",
|
|
"HVC": "Chemical industry",
|
|
"HVC (mechanical recycling)": "Chemical industry",
|
|
"HVC (chemical recycling)": "Chemical industry",
|
|
"Methanol": "Chemical industry",
|
|
"Chlorine": "Chemical industry",
|
|
"Other chemicals": "Chemical industry",
|
|
"Pharmaceutical products etc.": "Chemical industry",
|
|
"Cement": "Cement",
|
|
"Ceramics & other NMM": "Non-metallic mineral products",
|
|
"Glass production": "Glass",
|
|
"Pulp production": "Paper and printing",
|
|
"Paper production": "Paper and printing",
|
|
"Printing and media reproduction": "Paper and printing",
|
|
"Alumina production": "Non-ferrous metals",
|
|
"Aluminium - primary production": "Non-ferrous metals",
|
|
"Aluminium - secondary production": "Non-ferrous metals",
|
|
"Other non-ferrous metals": "Non-ferrous metals",
|
|
}
|
|
|
|
|
|
def build_nodal_industrial_production():
|
|
fn = snakemake.input.industrial_production_per_country_tomorrow
|
|
industrial_production = pd.read_csv(fn, index_col=0)
|
|
|
|
fn = snakemake.input.industrial_distribution_key
|
|
keys = pd.read_csv(fn, index_col=0)
|
|
keys["country"] = keys.index.str[:2]
|
|
|
|
nodal_production = pd.DataFrame(
|
|
index=keys.index, columns=industrial_production.columns, dtype=float
|
|
)
|
|
|
|
countries = keys.country.unique()
|
|
sectors = industrial_production.columns
|
|
|
|
for country, sector in product(countries, sectors):
|
|
buses = keys.index[keys.country == country]
|
|
mapping = sector_mapping.get(sector, "population")
|
|
|
|
key = keys.loc[buses, mapping]
|
|
nodal_production.loc[buses, sector] = (
|
|
industrial_production.at[country, sector] * key
|
|
)
|
|
|
|
nodal_production.to_csv(snakemake.output.industrial_production_per_node)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if "snakemake" not in globals():
|
|
from _helpers import mock_snakemake
|
|
|
|
snakemake = mock_snakemake("build_industrial_production_per_node", clusters=48)
|
|
set_scenario_config(snakemake)
|
|
|
|
build_nodal_industrial_production()
|