Merge branch 'master' into introduce_hac_clustering

This commit is contained in:
Martha Frysztacki 2022-03-17 17:40:46 +01:00 committed by GitHub
commit 69c0341145
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 11 deletions

View File

@ -50,9 +50,9 @@ The dataset consists of:
- A grid model based on a modified [GridKit](https://github.com/bdw/GridKit)
extraction of the [ENTSO-E Transmission System
Map](https://www.entsoe.eu/data/map/). The grid model contains 6001 lines
Map](https://www.entsoe.eu/data/map/). The grid model contains 6763 lines
(alternating current lines at and above 220kV voltage level and all high
voltage direct current lines) and 3657 substations.
voltage direct current lines) and 3642 substations.
- The open power plant database
[powerplantmatching](https://github.com/FRESNA/powerplantmatching).
- Electrical demand time series from the

View File

@ -1,6 +1,6 @@
# Unofficial ENTSO-E dataset processed by GridKit
This dataset was generated based on a map extract from May 25, 2018.
This dataset was generated based on a map extract from March 2022.
This is an _unofficial_ extract of the
[ENTSO-E interactive map](https://www.entsoe.eu/data/map/)
of the European power system (including to a limited extent North

View File

@ -6,7 +6,7 @@ logging,,,
-- format,--,"","Custom format for log messages. See `LogRecord <https://docs.python.org/3/library/logging.html#logging.LogRecord>`_ attributes."
summary_dir,--,"e.g. 'results'","Directory into which results are written."
countries,--,"Subset of {'AL', 'AT', 'BA', 'BE', 'BG', 'CH', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'ME', 'MK', 'NL', 'NO', 'PL', 'PT', 'RO', 'RS', 'SE', 'SI', 'SK'}","European countries defined by their `Two-letter country codes (ISO 3166-1) <https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>`_ which should be included in the energy system model."
focus_weights,--,"Keys should be two-digit country codes (e.g. DE) and values should range between 0 and 1","Ratio of total clusters for particular countries. the remaining weight is distributed according to mean load. An example: ``focus_weights: DE: 0.6 FR: 0.2``."
focus_weights,--,"Keys should be two-digit country codes (e.g. DE) and values should range between 0 and 1","Ratio of total clusters for particular countries. the remaining weight is distributed according to mean load. An example: ``focus_weights: 'DE': 0.6 'FR': 0.2``."
enable,,,
-- prepare_links_p_nom,bool,"{true, false}","Switch to retrieve current HVDC projects from `Wikipedia <https://en.wikipedia.org/wiki/List_of_HVDC_projects>`_"
-- retrieve_databundle,bool,"{true, false}","Switch to retrieve databundle from zenodo via the rule :mod:`retrieve_databundle` or whether to keep a custom databundle located in the corresponding folder."

1 Unit Values Description
6 -- format -- Custom format for log messages. See `LogRecord <https://docs.python.org/3/library/logging.html#logging.LogRecord>`_ attributes.
7 summary_dir -- e.g. 'results' Directory into which results are written.
8 countries -- Subset of {'AL', 'AT', 'BA', 'BE', 'BG', 'CH', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'ME', 'MK', 'NL', 'NO', 'PL', 'PT', 'RO', 'RS', 'SE', 'SI', 'SK'} European countries defined by their `Two-letter country codes (ISO 3166-1) <https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>`_ which should be included in the energy system model.
9 focus_weights -- Keys should be two-digit country codes (e.g. DE) and values should range between 0 and 1 Ratio of total clusters for particular countries. the remaining weight is distributed according to mean load. An example: ``focus_weights: DE: 0.6 FR: 0.2``. Ratio of total clusters for particular countries. the remaining weight is distributed according to mean load. An example: ``focus_weights: 'DE': 0.6 'FR': 0.2``.
10 enable
11 -- prepare_links_p_nom bool {true, false} Switch to retrieve current HVDC projects from `Wikipedia <https://en.wikipedia.org/wiki/List_of_HVDC_projects>`_
12 -- retrieve_databundle bool {true, false} Switch to retrieve databundle from zenodo via the rule :mod:`retrieve_databundle` or whether to keep a custom databundle located in the corresponding folder.

View File

@ -343,9 +343,9 @@ def clustering_for_n_clusters(n, n_clusters, custom_busmap=False, aggregate_carr
logger.info(f"Clustering network using algorithm `{algorithm}` and feature `{feature}`...")
if potential_mode == 'simple':
p_nom_max_strategy = np.sum
p_nom_max_strategy = pd.Series.sum
elif potential_mode == 'conservative':
p_nom_max_strategy = np.min
p_nom_max_strategy = pd.Series.min
else:
raise AttributeError(f"potential_mode should be one of 'simple' or 'conservative' but is '{potential_mode}'")
@ -361,7 +361,7 @@ def clustering_for_n_clusters(n, n_clusters, custom_busmap=False, aggregate_carr
aggregate_generators_carriers=aggregate_carriers,
aggregate_one_ports=["Load", "StorageUnit"],
line_length_factor=line_length_factor,
generator_strategies={'p_nom_max': p_nom_max_strategy, 'p_nom_min': np.sum},
generator_strategies={'p_nom_max': p_nom_max_strategy, 'p_nom_min': pd.Series.sum},
scale_link_capital_costs=False)
if not n.links.empty:

View File

@ -54,7 +54,7 @@ Replacing '/summaries/' with '/plots/' creates nice colored maps of the results.
"""
import logging
from _helpers import configure_logging, retrieve_snakemake_keys
from _helpers import configure_logging
import os
import pypsa
@ -430,7 +430,8 @@ if __name__ == "__main__":
network_dir = os.path.join('results', 'networks')
configure_logging(snakemake)
paths, config, wildcards, logs, out = retrieve_snakemake_keys(snakemake)
config = snakemake.config
wildcards = snakemake.wildcards
def expand_from_wildcard(key, config):
w = getattr(wildcards, key)
@ -451,6 +452,6 @@ if __name__ == "__main__":
for l in ll
for opts in expand_from_wildcard("opts", config)}
dfs = make_summaries(networks_dict, paths, config, country=wildcards.country)
dfs = make_summaries(networks_dict, snakemake.input, config, country=wildcards.country)
to_csv(dfs, out[0])
to_csv(dfs, snakemake.output[0])