new column add (solar / new trainingset)

This commit is contained in:
Mark Kors
2025-11-14 10:33:23 +01:00
parent d09c946bd8
commit 2a47ae4ee0
4 changed files with 11660 additions and 11585 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 137 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -44,7 +44,8 @@ def haal_recente_weerdata_op(aantal_dagen_terug):
"wind_direction_10m",
"relative_humidity_2m",
"cloud_cover",
"surface_pressure"
"surface_pressure",
"shortwave_radiation"
],
"timezone": "Europe/Amsterdam",
"past_days": int(aantal_dagen_terug) # Vraag data op van de afgelopen X dagen
@@ -75,7 +76,8 @@ def parse_api_data(data):
"wind_richting": hourly['wind_direction_10m'],
"luchtvochtigheid": hourly['relative_humidity_2m'],
"bewolking": hourly['cloud_cover'],
"luchtdruk": hourly['surface_pressure']
"luchtdruk": hourly['surface_pressure'],
"zonnestraling": hourly['shortwave_radiation']
})
# Vervang 'None' of 'NaN' door None (dat MySQL als NULL begrijpt)
df = df.where(pd.notnull(df), None)
@@ -101,8 +103,8 @@ def sla_data_op_mysql(conn, data_df):
query = """
INSERT INTO amersfoort_weer_uurlijks
(datum_tijd, locatie, temperatuur, gevoelstemperatuur, neerslag,
wind_snelheid, wind_richting, luchtvochtigheid, bewolking, luchtdruk)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
wind_snelheid, wind_richting, luchtvochtigheid, bewolking, luchtdruk, zonnestraling)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
ON DUPLICATE KEY UPDATE
locatie = VALUES(locatie),
temperatuur = VALUES(temperatuur),
@@ -112,7 +114,8 @@ def sla_data_op_mysql(conn, data_df):
wind_richting = VALUES(wind_richting),
luchtvochtigheid = VALUES(luchtvochtigheid),
bewolking = VALUES(bewolking),
luchtdruk = VALUES(luchtdruk);
luchtdruk = VALUES(luchtdruk),
zonnestraling = VALUES(zonnestraling);
"""
try: