diff --git a/config/plot_config.yaml b/config/plot_config.yaml index 93bff209..b956e0b0 100644 --- a/config/plot_config.yaml +++ b/config/plot_config.yaml @@ -5,7 +5,7 @@ plotting: network_style_config_file: "config/plotting_styles/network_map.mplstyle" transparent: false statistics: - clip_numerical_zeroes: false + clip_numerical_zeroes: true cost_panel: y_axis: "annualized system cost bEUR/a" # only true if investment period is one year cost_map: @@ -64,7 +64,7 @@ plotting: conv_techs: [ "gas", "gas-heat", "gas-AC", "AC-gas", "coal", "coal-AC","solar thermal","AC-heat","AC-AC","stations-AC","uranium", "H2-AC", "H2-gas",] storage_techs: [ "hydro+PHS", "battery", "AC-battery", "H2", "AC-H2" , "AC-heat"] - nan_color: "pink" + nan_color: "brown" tech_colors: blank: "white" @@ -127,11 +127,11 @@ plotting: biomass to liquid: '#32CD32' BioSNG: '#123456' # coal - coal carbon capture: '#8487e8' - coal-CCS: '#8487e8' - coal cc: '#8487e8' - coal ccs: '#8487e8' - coal power plant retrofit: '#8487e8' + coal carbon capture: '#8c8dad' + coal-CCS: '#8c8dad' + coal cc: '#8c8dad' + coal ccs: '#8c8dad' + coal power plant retrofit: '#8c8dad' # gas gas: '#e0986c' # gas: '#e05b09' @@ -240,8 +240,8 @@ plotting: services rural resistive heater: '#a5ed9d' services urban decentral resistive heater: '#98e991' urban central resistive heater: '#8cdf85' - retrofitting: '#8487e8' - building retrofitting: '#8487e8' + retrofitting: '#8c8dad' + building retrofitting: '#8c8dad' # hydrogen H2 for industry: "#f073da" @@ -286,6 +286,7 @@ plotting: services urban decentral solar thermal: '#dfb953' urban central solar thermal: '#d7b24c' solar rooftop: '#ffea80' + csp: "#ffe76e" # wind wind: "#235ebc" onwind: "#235ebc" @@ -332,6 +333,8 @@ plotting: industry new electricity: '#2d2a66' agriculture electricity: '#494778' load shedding: "#dd2e23" + Load shedding: "#dd2e23" + Load Shedding: "#dd2e23" # syngas Sabatier: '#9850ad' methanation: '#c44ce6' @@ -400,7 +403,6 @@ plotting: CCGT: "Combined-Cycle Gas" gas CCGT: "Combined-Cycle Gas" gas ccs: "Gas with Carbon Capture" - CCGT gas: "Combined-Cycle Gas" gas: Gas heat pump: "Heat Pump" stations-AC: "Reservoir & Dam" @@ -424,12 +426,11 @@ plotting: solar thermal: "Solar Thermal" uranium: "Nuclear" hydroelectricity: "Hydroelectricity" - energy: - coal: "Coal" - offwind: "Offshore Wind" - onwind: "Onshore Wind" - solar: "Solar" - solar thermal: "Solar Thermal" + coal: "Coal" + offwind: "Offshore Wind" + onwind: "Onshore Wind" + solar: "Solar" + solar thermal: "Solar Thermal" preferred_order: - electric load diff --git a/workflow/scripts/_pypsa_helpers.py b/workflow/scripts/_pypsa_helpers.py index c631bb0a..e6eed6de 100644 --- a/workflow/scripts/_pypsa_helpers.py +++ b/workflow/scripts/_pypsa_helpers.py @@ -107,10 +107,13 @@ def calc_lcoe( capex = n.statistics.expanded_capex(groupby=grouper, **kwargs) tot_capex = n.statistics.capex(groupby=grouper, **kwargs) supply = n.statistics.supply(groupby=grouper, **kwargs) - # restore original marginal costs n.links.marginal_cost = original_marginal_costs + # incase no grouper was specified, get different levels + if grouper is None: + supply = supply.groupby(level=[0, 1]).sum() + outputs = pd.concat( [opex, capex, tot_capex, rev, supply], axis=1, diff --git a/workflow/scripts/plot_network.py b/workflow/scripts/plot_network.py index 559d1956..06961c63 100644 --- a/workflow/scripts/plot_network.py +++ b/workflow/scripts/plot_network.py @@ -247,7 +247,9 @@ def calc_link_plot_width(row, carrier="AC", additions=False): # ============ === Stats by bus === # calc costs & sum over component types to keep bus & carrier (remove no loc) costs = network.statistics.capex(groupby=["location", "carrier"]) - costs = costs.groupby(level=[1, 2]).sum().drop("") + costs = costs.groupby(level=[1, 2]).sum() + if "" in costs.index: + costs.drop("", inplace=True) # we miss some buses by grouping epr location, fill w 0s bus_idx = pd.MultiIndex.from_product([network.buses.index, ["AC"]]) costs = costs.reindex(bus_idx.union(costs.index), fill_value=0) @@ -632,7 +634,7 @@ def calc_plot_width(row, carrier="AC"): "plot_network", topology="current+FCG", # co2_pathway="exp175default", - co2_pathway="SSP2-PkBudg1000_CHAb", + co2_pathway="SSP2-PkBudg1000-CHA-pypsaelh2", planning_horizons="2030", # heating_demand="positive", configfiles=["resources/tmp/remind_coupled_cg.yaml"], diff --git a/workflow/scripts/plot_statistics.py b/workflow/scripts/plot_statistics.py index 6730e9d4..801b18f8 100644 --- a/workflow/scripts/plot_statistics.py +++ b/workflow/scripts/plot_statistics.py @@ -62,7 +62,7 @@ def plot_static_per_carrier(ds: DataFrame, ax: axes.Axes, colors: DataFrame, dro planning_horizons="2025", # co2_pathway="exp175default", # planning_horizons="2130", - co2_pathway="SSP2-PkBudg1000_CHAb", + co2_pathway="SSP2-PkBudg1000-CHA-pypsaelh2", topology="current+FCG", # heating_demand="positive", configfiles="resources/tmp/remind_coupled_cg.yaml", diff --git a/workflow/scripts/plot_summary_all.py b/workflow/scripts/plot_summary_all.py index 0a42529b..ee255e6e 100644 --- a/workflow/scripts/plot_summary_all.py +++ b/workflow/scripts/plot_summary_all.py @@ -195,6 +195,7 @@ def plot_pathway_capacities( year = cap_df.columns.get_level_values(0)[0] cap_df = cap_df.droplevel(0, axis=1).rename(columns={"Unnamed: 4_level_1": year}) cap_df /= PLOT_CAP_UNITS + cap_df.drop("Load Shedding", level="carrier", inplace=True) # get stores relevant for reporting according to config, use later stores = ( @@ -278,7 +279,7 @@ def plot_pathway_capacities( labels.reverse() if capacity_df.index.difference(caps_stores.index).empty: - ax.set_ylabel(f"Installed Capacity [{PLOT_CAP_LABEL}h]") + ax.set_ylabel(f"Installed Storage Capacity [{PLOT_CAP_LABEL}h]") else: ax.set_ylabel(f"Installed Capacity [{PLOT_CAP_LABEL}]") ax.set_ylim([0, capacity_df.sum(axis=0).max() * 1.1]) @@ -807,6 +808,10 @@ def plot_co2_shadow_price(file_list: list, config: dict, fig_name=None): fig.savefig(fig_name, transparent=config["transparent"]) +def plot_investments(file_list: list, config: dict, fig_name=None, ax: object = None): + pass + + # TODO move to a separate rule def write_data(data_paths: dict, outp_dir: os.PathLike): """Write some selected data @@ -856,20 +861,9 @@ def write_data(data_paths: dict, outp_dir: os.PathLike): "plot_summary", topology="current+FCG", # co2_pathway="exp175default", - co2_pathway="SSP2-PkBudg1000-freeze", + co2_pathway="SSP2-PkBudg1000-CHA-pypsaelh2", heating_demand="positive", - configfiles=["resources/tmp/remind_coupled.yaml"], - planning_horizons=[ - 2020, - 2025, - 2030, - # 2035, - # 2040, - # 2045, - # 2050, - # 2055, - # 2060, - ], + configfiles=["resources/tmp/remind_coupled_cg.yaml"], ) configure_logging(snakemake) @@ -920,8 +914,8 @@ def write_data(data_paths: dict, outp_dir: os.PathLike): "battery", "coal", "coal-CCS", - "CCGT", - "OCGT", + "gas CCGT", + "gas OCGT", "CCGT-CCS", "H2 Electrolysis", ], diff --git a/workflow/scripts/plot_time_series.py b/workflow/scripts/plot_time_series.py index ac5f5291..fb5b09d7 100644 --- a/workflow/scripts/plot_time_series.py +++ b/workflow/scripts/plot_time_series.py @@ -415,7 +415,7 @@ def plot_price_heatmap( co2_pathway="SSP2-PkBudg1000-CHA-pypsaelh2", heating_demand="positive", configfiles=["resources/tmp/remind_coupled_cg.yaml"], - planning_horizons="2035", + planning_horizons="2050", winter_day1="12-10 21:00", # mm-dd HH:MM winter_day2="12-17 12:00", # mm-dd HH:MM spring_day1="03-31 21:00", # mm-dd HH:MM