47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
# scripts/plot_diurnal_cycle.py
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from meteo.dataset import load_raw_csv
|
|
from meteo.variables import VARIABLES_BY_KEY
|
|
from meteo.analysis import compute_diurnal_cycle_statistics
|
|
from meteo.plots import plot_diurnal_cycle
|
|
|
|
|
|
CSV_PATH = Path("data/weather_minutely.csv")
|
|
OUTPUT_PATH = Path("figures/diurnal_cycle/diurnal_cycle.png")
|
|
|
|
VARIABLE_KEYS = ["temperature", "humidity", "pressure", "wind_speed", "illuminance"]
|
|
|
|
|
|
def main() -> None:
|
|
if not CSV_PATH.exists():
|
|
print(f"⚠ Fichier introuvable : {CSV_PATH}")
|
|
return
|
|
|
|
df = load_raw_csv(CSV_PATH)
|
|
print(f"Dataset minuté chargé : {CSV_PATH}")
|
|
print(f" Lignes : {len(df)}")
|
|
print(f" Colonnes : {list(df.columns)}")
|
|
print()
|
|
|
|
variables = [VARIABLES_BY_KEY[key] for key in VARIABLE_KEYS]
|
|
stats = compute_diurnal_cycle_statistics(
|
|
df=df,
|
|
variables=variables,
|
|
quantiles=(0.25, 0.75),
|
|
)
|
|
|
|
output_path = plot_diurnal_cycle(
|
|
stats=stats,
|
|
variables=variables,
|
|
output_path=OUTPUT_PATH,
|
|
)
|
|
|
|
print(f"✔ Cycle diurne sauvegardé : {output_path}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|