Skip to content

Commit

Permalink
Backport PR #743: fix: relax constraint for overlaying plot traces fo…
Browse files Browse the repository at this point in the history
…r sensors with various resolutions (#743)

This PR makes it possible to show e.g. two price sensors in one chart, where one of them records hourly prices and the other records quarterhourly prices.

* fix: relax constraint for overlaying plot traces for sensors with various resolutions

Signed-off-by: F.N. Claessen <felix@seita.nl>

* docs: changelog entry

Signed-off-by: F.N. Claessen <felix@seita.nl>

---------

Signed-off-by: F.N. Claessen <felix@seita.nl>
  • Loading branch information
Flix6x committed Jun 26, 2023
1 parent 285e79f commit 38715bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions documentation/changelog.rst
Expand Up @@ -12,6 +12,7 @@ Bugfixes
* Relax constraint validation of `StorageScheduler` to accommodate violations caused by floating point precision [see `PR #731 <https://www.github.com/FlexMeasures/flexmeasures/pull/731>`_]
* Avoid saving any :abbr:`NaN (not a number)` values to the database, when calling ``flexmeasures add report`` [see `PR #735 <https://www.github.com/FlexMeasures/flexmeasures/pull/735>`_]
* Fix browser console error when loading asset or sensor page with only a single data point [see `PR #732 <https://www.github.com/FlexMeasures/flexmeasures/pull/732>`_]
* Relax constraint for overlaying plot traces for sensors with various resolutions, making it possible to show e.g. two price sensors in one chart, where one of them records hourly prices and the other records quarter-hourly prices [see `PR #743 <https://www.github.com/FlexMeasures/flexmeasures/pull/743>`_]


v0.14.0 | June 15, 2023
Expand Down
6 changes: 3 additions & 3 deletions flexmeasures/data/models/charts/belief_charts.py
Expand Up @@ -271,9 +271,9 @@ def create_line_layer(
event_value_field_definition: dict,
):
event_resolutions = list(set([sensor.event_resolution for sensor in sensors]))
assert (
len(event_resolutions) == 1
), "Sensors shown within one row must share the same event resolution."
assert all(res == timedelta(0) for res in event_resolutions) or all(
res != timedelta(0) for res in event_resolutions
), "Sensors shown within one row must all be instantaneous (zero event resolution) or all be non-instantatneous (non-zero event resolution)."
event_resolution = event_resolutions[0]
line_layer = {
"mark": {
Expand Down

0 comments on commit 38715bc

Please sign in to comment.