Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -599,7 +599,7 @@ def page_model(): #, write_pickle_from_standard_excel, color_dict):
|
|
599 |
df_production = plot_production(m, i_with_capacity, dt, color_dict, colb2, df)
|
600 |
# df_price = plot_electricity_prices(m, dt, colb2, df)
|
601 |
df_curtailment = plot_curtailment(m, iRes, color_dict, colb1, df)
|
602 |
-
df_residual_load_duration = plot_residual_load_duration(m, dt, colb1, df, D_t, i_with_capacity, iRes, color_dict, df_curtailment)
|
603 |
df_price = plot_electricity_prices(m, dt, colb2, df, df_residual_load_duration)
|
604 |
|
605 |
df_contr_marg = plot_contribution_margin(m, dt, i_with_capacity, color_dict, colb1, df)
|
@@ -897,7 +897,7 @@ def plot_electricity_prices(m, dt, col, df, df_residual_load_duration):
|
|
897 |
|
898 |
return df_price
|
899 |
|
900 |
-
def plot_residual_load_duration(m, dt, col, df, D_t, i_with_capacity, iRes, color_dict, df_curtailment):
|
901 |
"""
|
902 |
Plots the residual load and corresponding production as a stacked area chart.
|
903 |
Supports both German and English labels for the plot titles and axis labels.
|
@@ -961,9 +961,19 @@ def plot_residual_load_duration(m, dt, col, df, D_t, i_with_capacity, iRes, colo
|
|
961 |
|
962 |
# Plotting with Plotly - Creating stacked area chart
|
963 |
fig = go.Figure()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
964 |
|
965 |
# Add stacked area traces for each production technology with consistent colors and language-specific names
|
966 |
-
for tech in
|
967 |
tech_name = tech_mapping_en_to_de.get(tech, tech) # Get the translated name or fallback to the original
|
968 |
fig.add_trace(go.Scatter(
|
969 |
x=df_sorted.index,
|
|
|
599 |
df_production = plot_production(m, i_with_capacity, dt, color_dict, colb2, df)
|
600 |
# df_price = plot_electricity_prices(m, dt, colb2, df)
|
601 |
df_curtailment = plot_curtailment(m, iRes, color_dict, colb1, df)
|
602 |
+
df_residual_load_duration = plot_residual_load_duration(m, dt, colb1, df, D_t, i_with_capacity, iRes, color_dict, df_curtailment, iConv)
|
603 |
df_price = plot_electricity_prices(m, dt, colb2, df, df_residual_load_duration)
|
604 |
|
605 |
df_contr_marg = plot_contribution_margin(m, dt, i_with_capacity, color_dict, colb1, df)
|
|
|
897 |
|
898 |
return df_price
|
899 |
|
900 |
+
def plot_residual_load_duration(m, dt, col, df, D_t, i_with_capacity, iRes, color_dict, df_curtailment, iConv):
|
901 |
"""
|
902 |
Plots the residual load and corresponding production as a stacked area chart.
|
903 |
Supports both German and English labels for the plot titles and axis labels.
|
|
|
961 |
|
962 |
# Plotting with Plotly - Creating stacked area chart
|
963 |
fig = go.Figure()
|
964 |
+
|
965 |
+
# Sort technology_columns based on the highest index in df_sorted (only for iConv); others are placed at the end
|
966 |
+
sorted_technology_columns = sorted(
|
967 |
+
technology_columns,
|
968 |
+
key=lambda tech: (
|
969 |
+
tech not in iConv, # Place non-iConv technologies at the end
|
970 |
+
-df_sorted[df_sorted[tech] != 0].index.max() if tech in iConv and not df_sorted[df_sorted[tech] != 0].empty else float('inf')
|
971 |
+
)
|
972 |
+
)
|
973 |
+
|
974 |
|
975 |
# Add stacked area traces for each production technology with consistent colors and language-specific names
|
976 |
+
for tech in sorted_technology_columns:
|
977 |
tech_name = tech_mapping_en_to_de.get(tech, tech) # Get the translated name or fallback to the original
|
978 |
fig.add_trace(go.Scatter(
|
979 |
x=df_sorted.index,
|