diff options
-rw-r--r-- | windy/point_forecast.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/windy/point_forecast.py b/windy/point_forecast.py index 8d55c5f..c15f3b2 100644 --- a/windy/point_forecast.py +++ b/windy/point_forecast.py @@ -10,6 +10,10 @@ def _json(value): return value +def _convert_notation(unit): + return unit.replace("-1", "^-1") + + class _StrEnum(Enum): def __str__(self): return self.value @@ -102,9 +106,9 @@ class Response: def __init__(self, registry, raw): self.timestamps = [datetime.fromtimestamp(x // 1000) for x in raw['ts']] self.samples = {} - parameters = ((x, registry(raw['units'][x])) for x in raw if x not in self._INTERNAL_FIELDS) + parameters = ((x, raw['units'][x]) for x in raw if x not in self._INTERNAL_FIELDS) for parameter, unit in parameters: - self.samples[parameter] = [x * unit for x in raw[parameter]] + self.samples[parameter] = [x * registry(_convert_notation(unit)) for x in raw[parameter]] def __len__(self): return len(self._timestamps) |