diff options
author | Aki <please@ignore.pl> | 2023-03-29 20:59:03 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2023-03-29 20:59:03 +0200 |
commit | 0a1b3bfeb7e4b52349053025b347d64ad51428e4 (patch) | |
tree | 62b430d7d72955c9a4d1588b258a893d7229d4e1 | |
parent | 806110131888b5c925178d963676249b6d286d8c (diff) | |
download | windy-0a1b3bfeb7e4b52349053025b347d64ad51428e4.zip windy-0a1b3bfeb7e4b52349053025b347d64ad51428e4.tar.gz windy-0a1b3bfeb7e4b52349053025b347d64ad51428e4.tar.bz2 |
Readded Prediction.at(parameter, level)
-rw-r--r-- | windy/point_forecast.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/windy/point_forecast.py b/windy/point_forecast.py index 844cef3..34d13b5 100644 --- a/windy/point_forecast.py +++ b/windy/point_forecast.py @@ -133,6 +133,10 @@ class Prediction: def parameters(self) -> tuple: return self._response.parameters + def at(self, parameter, level): + level = self._response.raw_predictions['level'][self._index].index(level) + return self._response.raw_predictions[parameter][self._index][level] + def __iter__(self): return iter(self.parameters) @@ -202,6 +206,15 @@ class Response: profile[0], profile[new_index] = profile[new_index], profile[0] profiles.append(np.array(profile) * units[parameter]) self.raw_predictions[parameter] = profiles + levels = [] + for index in range(len(self.timestamps)): + profile = list(all_levels) + if pressure_sort: + new_index = pressure_sort[index] + profile[0], profile[new_index] = profile[new_index], profile[0] + levels.append(profile) + self.raw_predictions['level'] = levels + def __len__(self): return len(self.timestamps) |