Skip to content

Commit 543fcb7

Browse files
authored
Merge pull request #78 from cyiallou/feat/upgrade-prod-table
Consolidate production stats into a single table for multiple microgrids
2 parents 0ea4262 + 1431476 commit 543fcb7

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
<!-- Here goes a general summary of what this release is about -->
66

77
## Upgrading
8-
9-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
8+
* Refactored the solar maintenance workflow to aggregate production statistics from all requested microgrids into a single table instead of creating one table per microgrid.
109

1110
## New Features
1211

src/frequenz/lib/notebooks/solar/maintenance/solar_maintenance_app.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ async def run_workflow(
192192
"x_axis_label": "x-axis",
193193
"verbose": config.verbose,
194194
}
195+
production_table_view_list = []
195196
# pylint: disable-next=too-many-nested-blocks
196197
for mid in reporting_data.microgrid_id.unique():
197198
message = f"Generating plots for microgrid ID: {mid}"
@@ -352,8 +353,10 @@ async def run_workflow(
352353
# ------------------- #
353354

354355
# --- generate the production statistics table --- #
355-
production_statistics_table_df = StatsPreparer(stats_view_config).prepare(data)
356-
style_table(production_statistics_table_df, show=True)
356+
_prod_table = StatsPreparer(stats_view_config).prepare(data)
357+
_prod_table.index = pd.Index([mid])
358+
_prod_table.index.name = "Microgrid ID"
359+
production_table_view_list.append(_prod_table)
357360
# ------------------- #
358361

359362
# --- short-term view --- #
@@ -743,14 +746,20 @@ async def run_workflow(
743746
for fig in figures_and_axes.keys():
744747
plot_manager.adjust_axes_spacing(fig_id=fig, pixels=100.0)
745748

749+
if production_table_view_list:
750+
production_table_view = pd.concat(production_table_view_list, axis=0)
751+
production_table_view.reset_index(inplace=True)
752+
style_table(production_table_view, show=True)
753+
else:
754+
production_table_view = pd.DataFrame()
746755
return {
747756
"real_time_view": rolling_view_real_time,
748757
"rolling_view_short_term": rolling_view_short_term,
749758
"rolling_view_long_term": rolling_view_long_term,
750759
"rolling_view_average": rolling_view_average,
751760
"daily_production": daily_production_view,
752761
"statistical_profiles": statistical_view,
753-
"production_statistics_table": production_statistics_table_df,
762+
"production_statistics_table": production_table_view,
754763
}
755764

756765

0 commit comments

Comments
 (0)