Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plotting script for FE KPIs #37

Open
wants to merge 39 commits into
base: form_energy_storage_dev
Choose a base branch
from

Conversation

virio-andreyana
Copy link

Closes #34

New Features

  • Curtailment map
  • Line loading map
  • Energy balance time series
  • Emission bar (detail and overview)
  • System cost bar (detail and overview)
  • Capacity bar (detail and overview), also added the option to chose install, optimal, expand
  • Annual Generation bar (detail and overview)

The time series and the bar are created based on the config file, for example

  country_system_cost:
    extract: system cost
    exclude: ["EU"]
    carrier_filter:
    group_carrier: sector
    plot: overview
    plot_kw:
      title: Country system cost
      ylim: [0,150]
      ylabel: Billion EUR/a

automaticly creates this plot and save the file based on the name country_system_cost. The documentation is under construction.

country_system_cost

Other example:

  DE_electricity_plus_winter_energy_balance:
    extract: time series
    start_date: '2013-02-01'
    end_date: '2013-03-01'
    include: ["DE"]
    carrier_filter: electricity+
    group_carrier: pretty
    plot_kw:
      title: Germany winter high and low voltage energy balance
      ylim: [-50,200]
      ylabel: MW

DE_electricity_plus_winter_energy_balance

Checklist

  • I tested my contribution locally and it works as intended.
  • Code and workflow changes are sufficiently documented.
  • Changes in configuration options are added in config/config.default.yaml.
  • Changes in configuration options are documented in doc/configtables/*.csv.
  • Sources of newly added data are documented in doc/data_sources.rst.
  • A release note doc/release_notes.rst is added.

daniel-rdt and others added 15 commits November 8, 2024 16:28
…nergy-transition/pypsa-eur into Form-feature/kpi-cost-curtailment
…urate electricity demand (from other sector).
…nergy-transition/pypsa-eur into Form-feature/kpi-cost-curtailment
…ost-curtailment

Form KPI visualization script and functions
…of figures based on the configuration for KPIs.
@virio-andreyana
Copy link
Author

Currently I have a problem in creating a snakemake output so that the output can expand based on the KPI list. The exception is "Not all output, log and benchmark files of rule plot_KPIs contain the same wildcards. This is crucial though, in order to avoid that two or more jobs write to the same file." This is referring to unpack(create_kpi_path). Do you have any suggestion @daniel-rdt @tgilon ?

def create_kpi_path(w):
    return {
        kpi_fn: RESULTS
        + "maps/base_s_{clusters}_l{ll}_{opts}_{sector_opts}-"
        + kpi_fn
        + "_{planning_horizons}.pdf"
        for kpi_fn in list(config_provider("kpi").keys())
    }

rule plot_KPIs:
    params:
        plotting=config_provider("plotting"),
        kpi=config_provider("plotting"),
    input:
        network=RESULTS
        + "postnetworks/base_s_{clusters}_l{ll}_{opts}_{sector_opts}_{planning_horizons}.nc",
        regions=resources("regions_onshore_base_s_{clusters}.geojson"),
        nodal_costs=RESULTS + "csvs/nodal_costs.csv",
        nodal_capacity=RESULTS + "csvs/nodal_capacities.csv",
    output:
        unpack(create_kpi_path),
...

@virio-andreyana
Copy link
Author

@daniel-rdt there is a simple workaround: The plots is created without going through the snakefile. I can extract the path from the still functioning curtailment_map or line_loading and put it there. The disadvantage is that you cannot request for it through snakemake, only infered request from curtailment_map or line_loading works. Do you want me to do that?

@daniel-rdt
Copy link
Collaborator

@daniel-rdt there is a simple workaround: The plots is created without going through the snakefile. I can extract the path from the still functioning curtailment_map or line_loading and put it there. The disadvantage is that you cannot request for it through snakemake, only infered request from curtailment_map or line_loading works. Do you want me to do that?

Hm, for the workflow to function that could be a valid plan B in my opinion. Let's have a quick chat about the snakemake issue and try to solve it.

@virio-andreyana virio-andreyana marked this pull request as ready for review December 17, 2024 09:43
for i in range(len(df.columns)):
if i == 0:
continue
df.iloc[:,i] = df.iloc[:,i] + df.iloc[:,i-1]
Copy link
Author

@virio-andreyana virio-andreyana Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: This needs to be recalculated because it disregards the impact of the time resolution. Also don't forget to change the unit to GWh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants