new column add (solar / new trainingset)
This commit is contained in:
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
@@ -44,7 +44,8 @@ def haal_recente_weerdata_op(aantal_dagen_terug):
|
|||||||
"wind_direction_10m",
|
"wind_direction_10m",
|
||||||
"relative_humidity_2m",
|
"relative_humidity_2m",
|
||||||
"cloud_cover",
|
"cloud_cover",
|
||||||
"surface_pressure"
|
"surface_pressure",
|
||||||
|
"shortwave_radiation"
|
||||||
],
|
],
|
||||||
"timezone": "Europe/Amsterdam",
|
"timezone": "Europe/Amsterdam",
|
||||||
"past_days": int(aantal_dagen_terug) # Vraag data op van de afgelopen X dagen
|
"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'],
|
"wind_richting": hourly['wind_direction_10m'],
|
||||||
"luchtvochtigheid": hourly['relative_humidity_2m'],
|
"luchtvochtigheid": hourly['relative_humidity_2m'],
|
||||||
"bewolking": hourly['cloud_cover'],
|
"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)
|
# Vervang 'None' of 'NaN' door None (dat MySQL als NULL begrijpt)
|
||||||
df = df.where(pd.notnull(df), None)
|
df = df.where(pd.notnull(df), None)
|
||||||
@@ -101,8 +103,8 @@ def sla_data_op_mysql(conn, data_df):
|
|||||||
query = """
|
query = """
|
||||||
INSERT INTO amersfoort_weer_uurlijks
|
INSERT INTO amersfoort_weer_uurlijks
|
||||||
(datum_tijd, locatie, temperatuur, gevoelstemperatuur, neerslag,
|
(datum_tijd, locatie, temperatuur, gevoelstemperatuur, neerslag,
|
||||||
wind_snelheid, wind_richting, luchtvochtigheid, bewolking, luchtdruk)
|
wind_snelheid, wind_richting, luchtvochtigheid, bewolking, luchtdruk, zonnestraling)
|
||||||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
|
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
|
||||||
ON DUPLICATE KEY UPDATE
|
ON DUPLICATE KEY UPDATE
|
||||||
locatie = VALUES(locatie),
|
locatie = VALUES(locatie),
|
||||||
temperatuur = VALUES(temperatuur),
|
temperatuur = VALUES(temperatuur),
|
||||||
@@ -112,7 +114,8 @@ def sla_data_op_mysql(conn, data_df):
|
|||||||
wind_richting = VALUES(wind_richting),
|
wind_richting = VALUES(wind_richting),
|
||||||
luchtvochtigheid = VALUES(luchtvochtigheid),
|
luchtvochtigheid = VALUES(luchtvochtigheid),
|
||||||
bewolking = VALUES(bewolking),
|
bewolking = VALUES(bewolking),
|
||||||
luchtdruk = VALUES(luchtdruk);
|
luchtdruk = VALUES(luchtdruk),
|
||||||
|
zonnestraling = VALUES(zonnestraling);
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user