diff options
author | Aki <please@ignore.pl> | 2022-10-08 11:22:36 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-10-08 11:22:36 +0200 |
commit | 18907effa86e5b7d56f2b68e241b6bf789049413 (patch) | |
tree | 727e81e01cc0fc4837e05842f46f5e19f85b7112 | |
parent | 7587e42259405cd2cca758639879f05b9f456f04 (diff) | |
download | windy-18907effa86e5b7d56f2b68e241b6bf789049413.zip windy-18907effa86e5b7d56f2b68e241b6bf789049413.tar.gz windy-18907effa86e5b7d56f2b68e241b6bf789049413.tar.bz2 |
Added helpers to access specific scalar values
-rw-r--r-- | windy/point_forecast.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/windy/point_forecast.py b/windy/point_forecast.py index 7e9304f..8ee4fe2 100644 --- a/windy/point_forecast.py +++ b/windy/point_forecast.py @@ -136,6 +136,12 @@ class Prediction: def levels(self, parameter) -> tuple: return self._response.levels(parameter) + def level(self, parameter, level) -> int: + return self._response.level(parameter, level) + + def at(self, parameter, level): + return self._response.raw_predictions[parameter][self._index][self.level(parameter, level)] + def __iter__(self): return iter(self.parameters) @@ -207,6 +213,9 @@ class Response: def levels(self, parameter) -> tuple: return self._levels[parameter] + def level(self, parameter, level) -> int: + return self.levels(parameter).index(Level(level)) + def predictions(self) -> Prediction: """ Yields Prediction for each time point available in this Response. |