From 728078825442cb12c8269a2507307c4c7cf4ed38 Mon Sep 17 00:00:00 2001 From: Felix Claessen <30658763+Flix6x@users.noreply.github.com> Date: Mon, 26 Jun 2023 09:47:01 +0200 Subject: [PATCH] Backport PR #738: Fix absolute currency units (#738) * fix case when unit is 'EUR' or some other bare currency code without some additional unit like 'EUR/MWh' Signed-off-by: F.N. Claessen * docs: changelog entry Signed-off-by: F.N. Claessen --------- Signed-off-by: F.N. Claessen --- documentation/changelog.rst | 1 + flexmeasures/utils/unit_utils.py | 1 + 2 files changed, 2 insertions(+) diff --git a/documentation/changelog.rst b/documentation/changelog.rst index 89410771f..454323e3d 100644 --- a/documentation/changelog.rst +++ b/documentation/changelog.rst @@ -12,6 +12,7 @@ Bugfixes * Relax constraint validation of `StorageScheduler` to accommodate violations caused by floating point precision [see `PR #731 `_] * Avoid saving any :abbr:`NaN (not a number)` values to the database, when calling ``flexmeasures add report`` [see `PR #735 `_] * Fix browser console error when loading asset or sensor page with only a single data point [see `PR #732 `_] +* Fix showing multiple sensors with bare 3-letter currency code as their units (e.g. EUR) in one chart [see `PR #738 `_] * Fix defaults for the ``--start-offset`` and ``--end-offset` options to ``flexmeasures add report``, which weren't being interpreted in the local timezone of the reporting sensor [see `PR #744 `_] * 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 `_] * Resolve bug where different page loads would potentially influence the time axis of each other's charts, by avoiding mutation of shared field definitions [see `PR #746 `_] diff --git a/flexmeasures/utils/unit_utils.py b/flexmeasures/utils/unit_utils.py index 4edd67460..13a110050 100644 --- a/flexmeasures/utils/unit_utils.py +++ b/flexmeasures/utils/unit_utils.py @@ -200,6 +200,7 @@ def is_energy_price_unit(unit: str) -> bool: """ if ( unit[:3] in [str(c) for c in list_all_currencies()] + and len(unit) > 3 and unit[3] == "/" and is_energy_unit(unit[4:]) ):