From 8c703c13a1ab3e1bd57f724b5cd435b6211d2337 Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Sat, 13 Nov 2021 09:46:19 +0100 Subject: [PATCH] extend the weather model --- aman/sys/WeatherModel.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/aman/sys/WeatherModel.py b/aman/sys/WeatherModel.py index 3b9a9cc..9372a6a 100644 --- a/aman/sys/WeatherModel.py +++ b/aman/sys/WeatherModel.py @@ -100,17 +100,20 @@ class WeatherModel: self.MaximumAltitude = -1 self.WindDirectionModel = None self.WindSpeedModel = None + self.Altitudes = None + self.Directions = None + self.Windspeeds = None if None != self.Weather.Provider.WindData and self.Gafor in self.Weather.Provider.WindData: - altitudes = [] - directions = [] - speeds = [] + self.Altitudes = [] + self.Directions = [] + self.Windspeeds = [] # collect the data for the wind model for level in self.Weather.Provider.WindData[self.Gafor]: - altitudes.append(level[0]) - directions.append(level[1]) - speeds.append(level[2]) + self.Altitudes.append(level[0]) + self.Directions.append(level[1]) + self.Windspeeds.append(level[2]) # define the thresholds for later boundary checks if self.MinimumAltitude > level[0]: @@ -119,9 +122,9 @@ class WeatherModel: self.MaximumAltitude = level[0] # calculate the models - if 1 < len(altitudes): - self.WindDirectionModel = scipy.interpolate.interp1d(altitudes, directions) - self.WindSpeedModel = scipy.interpolate.interp1d(altitudes, speeds) + if 1 < len(self.Altitudes): + self.WindDirectionModel = scipy.interpolate.interp1d(self.Altitudes, self.Directions) + self.WindSpeedModel = scipy.interpolate.interp1d(self.Altitudes, self.Windspeeds) self.LastWeatherUpdate = self.Weather.Provider.UpdateTime else: self.LastWeatherUpdate = None