remove plot_p_nom_max
This commit is contained in:
parent
6e1fb8049f
commit
ab501f3eb6
@ -24,9 +24,9 @@ ATLITE_NPROCESSES = config["atlite"].get("nprocesses", 4)
|
|||||||
|
|
||||||
|
|
||||||
wildcard_constraints:
|
wildcard_constraints:
|
||||||
simpl="[a-zA-Z0-9]*|all",
|
simpl="[a-zA-Z0-9]*",
|
||||||
clusters="[0-9]+m?|all",
|
clusters="[0-9]+m?",
|
||||||
ll="(v|c)([0-9\.]+|opt|all)|all",
|
ll="(v|c)([0-9\.]+|opt)",
|
||||||
opts="[-+a-zA-Z0-9\.]*",
|
opts="[-+a-zA-Z0-9\.]*",
|
||||||
sector_opts="[-+a-zA-Z0-9\.\s]*"
|
sector_opts="[-+a-zA-Z0-9\.\s]*"
|
||||||
|
|
||||||
|
@ -9,42 +9,6 @@ Plotting and Summary
|
|||||||
|
|
||||||
.. warning:: The corresponding code is currently under revision and has only minimal documentation.
|
.. warning:: The corresponding code is currently under revision and has only minimal documentation.
|
||||||
|
|
||||||
.. _plot_potentials:
|
|
||||||
|
|
||||||
Rule ``plot_p_nom_max``
|
|
||||||
==========================
|
|
||||||
|
|
||||||
.. graphviz::
|
|
||||||
:align: center
|
|
||||||
|
|
||||||
digraph snakemake_dag {
|
|
||||||
graph [bgcolor=white,
|
|
||||||
margin=0,
|
|
||||||
size="8,5"
|
|
||||||
];
|
|
||||||
node [fontname=sans,
|
|
||||||
fontsize=10,
|
|
||||||
penwidth=2,
|
|
||||||
shape=box,
|
|
||||||
style=rounded
|
|
||||||
];
|
|
||||||
edge [color=grey,
|
|
||||||
penwidth=2
|
|
||||||
];
|
|
||||||
0 [color="0.42 0.6 0.85",
|
|
||||||
fillcolor=gray,
|
|
||||||
label=plot_p_nom_max,
|
|
||||||
style=filled];
|
|
||||||
1 [color="0.58 0.6 0.85",
|
|
||||||
label=cluster_network];
|
|
||||||
1 -> 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
||||||
.. automodule:: plot_p_nom_max
|
|
||||||
|
|
||||||
.. _summary:
|
|
||||||
|
|
||||||
Rule ``make_summary``
|
Rule ``make_summary``
|
||||||
========================
|
========================
|
||||||
|
@ -128,10 +128,6 @@ series and potentials using the rule :mod:`build_renewable_profiles`.
|
|||||||
It can take the values ``onwind``, ``offwind-ac``, ``offwind-dc``, and ``solar`` but **not** ``hydro``
|
It can take the values ``onwind``, ``offwind-ac``, ``offwind-dc``, and ``solar`` but **not** ``hydro``
|
||||||
(since hydroelectric plant profiles are created by a different rule).
|
(since hydroelectric plant profiles are created by a different rule).
|
||||||
|
|
||||||
The wildcard can moreover be used to create technology specific figures and summaries.
|
|
||||||
For instance ``{technology}`` can be used to plot regionally disaggregated potentials
|
|
||||||
with the rule :mod:`plot_p_nom_max`.
|
|
||||||
|
|
||||||
.. _attr:
|
.. _attr:
|
||||||
|
|
||||||
The ``{attr}`` wildcard
|
The ``{attr}`` wildcard
|
||||||
@ -148,7 +144,7 @@ The ``{ext}`` wildcard
|
|||||||
======================
|
======================
|
||||||
|
|
||||||
The ``{ext}`` wildcard specifies the file type of the figures the
|
The ``{ext}`` wildcard specifies the file type of the figures the
|
||||||
rule :mod:`plot_network`, :mod:`plot_summary`, and :mod:`plot_p_nom_max` produce.
|
rule :mod:`plot_network` and :mod:`plot_summary` produce.
|
||||||
Typical examples are ``pdf`` and ``png``. The list of supported file
|
Typical examples are ``pdf`` and ``png``. The list of supported file
|
||||||
formats depends on the used backend. To query the supported file types on your system, issue:
|
formats depends on the used backend. To query the supported file types on your system, issue:
|
||||||
|
|
||||||
|
@ -1,91 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# SPDX-FileCopyrightText: : 2017-2023 The PyPSA-Eur Authors
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
"""
|
|
||||||
Plots renewable installation potentials per capacity factor.
|
|
||||||
|
|
||||||
Relevant Settings
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
Inputs
|
|
||||||
------
|
|
||||||
|
|
||||||
Outputs
|
|
||||||
-------
|
|
||||||
|
|
||||||
Description
|
|
||||||
-----------
|
|
||||||
"""
|
|
||||||
import logging
|
|
||||||
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
import pandas as pd
|
|
||||||
import pypsa
|
|
||||||
from _helpers import configure_logging
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
def cum_p_nom_max(net, tech, country=None):
|
|
||||||
carrier_b = net.generators.carrier == tech
|
|
||||||
|
|
||||||
generators = pd.DataFrame(
|
|
||||||
dict(
|
|
||||||
p_nom_max=net.generators.loc[carrier_b, "p_nom_max"],
|
|
||||||
p_max_pu=net.generators_t.p_max_pu.loc[:, carrier_b].mean(),
|
|
||||||
country=net.generators.loc[carrier_b, "bus"].map(net.buses.country),
|
|
||||||
)
|
|
||||||
).sort_values("p_max_pu", ascending=False)
|
|
||||||
|
|
||||||
if country is not None:
|
|
||||||
generators = generators.loc[generators.country == country]
|
|
||||||
|
|
||||||
generators["cum_p_nom_max"] = generators["p_nom_max"].cumsum() / 1e6
|
|
||||||
|
|
||||||
return generators
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
if "snakemake" not in globals():
|
|
||||||
from _helpers import mock_snakemake
|
|
||||||
|
|
||||||
snakemake = mock_snakemake(
|
|
||||||
"plot_p_nom_max",
|
|
||||||
simpl="",
|
|
||||||
techs="solar,onwind,offwind-dc",
|
|
||||||
ext="png",
|
|
||||||
clusts="5,full",
|
|
||||||
country="all",
|
|
||||||
)
|
|
||||||
configure_logging(snakemake)
|
|
||||||
|
|
||||||
plot_kwds = dict(drawstyle="steps-post")
|
|
||||||
|
|
||||||
clusters = snakemake.wildcards.clusts.split(",")
|
|
||||||
techs = snakemake.wildcards.techs.split(",")
|
|
||||||
country = snakemake.wildcards.country
|
|
||||||
if country == "all":
|
|
||||||
country = None
|
|
||||||
else:
|
|
||||||
plot_kwds["marker"] = "x"
|
|
||||||
|
|
||||||
fig, axes = plt.subplots(1, len(techs))
|
|
||||||
|
|
||||||
for j, cluster in enumerate(clusters):
|
|
||||||
net = pypsa.Network(snakemake.input[j])
|
|
||||||
|
|
||||||
for i, tech in enumerate(techs):
|
|
||||||
cum_p_nom_max(net, tech, country).plot(
|
|
||||||
x="p_max_pu", y="cum_p_nom_max", label=cluster, ax=axes[i], **plot_kwds
|
|
||||||
)
|
|
||||||
|
|
||||||
for i, tech in enumerate(techs):
|
|
||||||
ax = axes[i]
|
|
||||||
ax.set_xlabel(f"Capacity factor of {tech}")
|
|
||||||
ax.set_ylabel("Cumulative installable capacity / TW")
|
|
||||||
|
|
||||||
plt.legend(title="Cluster level")
|
|
||||||
|
|
||||||
fig.savefig(snakemake.output[0], transparent=True, bbox_inches="tight")
|
|
Loading…
Reference in New Issue
Block a user