final dashboard commit
This commit is contained in:
parent
76b5c25fee
commit
99e6901655
2 changed files with 49 additions and 48 deletions
|
@ -415,6 +415,7 @@ class PlantGrowthDashboard:
|
||||||
params['ambient_mode'] = self.ambient_mode.get()
|
params['ambient_mode'] = self.ambient_mode.get()
|
||||||
|
|
||||||
current_mode = self.ambient_mode.get()
|
current_mode = self.ambient_mode.get()
|
||||||
|
happy_data = 0
|
||||||
if current_mode == "open":
|
if current_mode == "open":
|
||||||
happy_data = self.happyMeteo.openMeteoCall(days_difference)
|
happy_data = self.happyMeteo.openMeteoCall(days_difference)
|
||||||
|
|
||||||
|
@ -432,6 +433,9 @@ class PlantGrowthDashboard:
|
||||||
'end_date': self.calendar.get_date().isoformat()
|
'end_date': self.calendar.get_date().isoformat()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if current_mode == "open":
|
||||||
|
submission_data['meteoForecast'] = happy_data
|
||||||
|
|
||||||
#Remove plant_info_text
|
#Remove plant_info_text
|
||||||
self.plant_info_text.delete(1.0, tk.END)
|
self.plant_info_text.delete(1.0, tk.END)
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,6 @@ class HappyMeteo:
|
||||||
|
|
||||||
# Process first location. Add a for-loop for multiple locations or weather models
|
# Process first location. Add a for-loop for multiple locations or weather models
|
||||||
response = responses[0]
|
response = responses[0]
|
||||||
print(f"Coordinates: {response.Latitude()}°N {response.Longitude()}°E")
|
|
||||||
print(f"Elevation: {response.Elevation()} m asl")
|
|
||||||
print(f"Timezone: {response.Timezone()}{response.TimezoneAbbreviation()}")
|
|
||||||
print(f"Timezone difference to GMT+0: {response.UtcOffsetSeconds()}s")
|
|
||||||
|
|
||||||
# Process daily data. The order of variables needs to be the same as requested.
|
# Process daily data. The order of variables needs to be the same as requested.
|
||||||
daily = response.Daily()
|
daily = response.Daily()
|
||||||
|
@ -63,21 +59,22 @@ class HappyMeteo:
|
||||||
daily_daylight_duration = daily.Variables(5).ValuesAsNumpy()
|
daily_daylight_duration = daily.Variables(5).ValuesAsNumpy()
|
||||||
daily_relative_humidity_2m_mean = daily.Variables(6).ValuesAsNumpy()
|
daily_relative_humidity_2m_mean = daily.Variables(6).ValuesAsNumpy()
|
||||||
|
|
||||||
daily_data = {"date": pd.date_range(
|
# Return comprehensive data structure
|
||||||
start = pd.to_datetime(daily.Time(), unit = "s", utc = True),
|
return {
|
||||||
end = pd.to_datetime(daily.TimeEnd(), unit = "s", utc = True),
|
"daily_data": {
|
||||||
freq = pd.Timedelta(seconds = daily.Interval()),
|
"weather_code": daily_weather_code.tolist(),
|
||||||
inclusive = "left"
|
"temperature_2m_mean": daily_temperature_2m_mean.tolist(),
|
||||||
)}
|
"rain_sum": daily_rain_sum.tolist(),
|
||||||
|
"showers_sum": daily_showers_sum.tolist(),
|
||||||
daily_data["weather_code"] = daily_weather_code
|
"precipitation_sum": daily_precipitation_sum.tolist(),
|
||||||
daily_data["temperature_2m_mean"] = daily_temperature_2m_mean
|
"daylight_duration": daily_daylight_duration.tolist(),
|
||||||
daily_data["rain_sum"] = daily_rain_sum
|
"relative_humidity_2m_mean": daily_relative_humidity_2m_mean.tolist()
|
||||||
daily_data["showers_sum"] = daily_showers_sum
|
},
|
||||||
daily_data["precipitation_sum"] = daily_precipitation_sum
|
"summary": {
|
||||||
daily_data["daylight_duration"] = daily_daylight_duration
|
"avg_temperature": float(daily_temperature_2m_mean.mean()),
|
||||||
daily_data["relative_humidity_2m_mean"] = daily_relative_humidity_2m_mean
|
"total_precipitation": float(daily_precipitation_sum.sum()),
|
||||||
|
"avg_humidity": float(daily_relative_humidity_2m_mean.mean()),
|
||||||
daily_dataframe = pd.DataFrame(data = daily_data)
|
"total_daylight_hours": float(daily_daylight_duration.sum() / 3600) # Convert seconds to hours
|
||||||
print("\nDaily data\n", daily_dataframe)
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue