Skip to content

Commit 66fa8f4

Browse files
authored
Merge pull request #72 from cyiallou/fix/small-data-crash
Fix: Handle KeyError in StatisticalPlotStyle duration calculation
2 parents 9108ac5 + d7ddf32 commit 66fa8f4

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616

1717
- Introduced `NoDataAvailableError` exception to represent situations where no data is available and to skip such cases during workflow execution and plotting.
1818
- Fixed a bug introduced in version `v0.5.2` where the microgrid tabular overview excluded current-day values from the total production for the past 30 and 365 days, causing inconsistencies with metrics that included today's data.
19+
- Fixed a crash in statistical plot style generation when the input data index is empty or contains only a single timestamp. Duration is now set to `None` when no `mode` can be determined.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ def get_plot_styles(
164164
.total_seconds()
165165
/ 60
166166
)
167+
except KeyError:
168+
duration = None # occurs when data_index is empty or has a single value
167169

168170
axes_params: dict[str, dict[str, str | int | list[str] | None]] = {
169171
"grouped": {

0 commit comments

Comments
 (0)