46 lines
1.2 KiB
Python
46 lines
1.2 KiB
Python
# scripts/plot_correlation_heatmap.py
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from meteo.dataset import load_raw_csv
|
|
from meteo.variables import VARIABLES
|
|
from meteo.analysis import compute_correlation_matrix_for_variables
|
|
from meteo.plots import plot_correlation_heatmap
|
|
|
|
|
|
CSV_PATH = Path("data/weather_minutely.csv")
|
|
OUTPUT_PATH = Path("figures/correlation_heatmap.png")
|
|
|
|
|
|
def main() -> None:
|
|
if not CSV_PATH.exists():
|
|
print(f"⚠ Fichier introuvable : {CSV_PATH}")
|
|
print(" Assurez-vous d'avoir généré le dataset minuté.")
|
|
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()
|
|
|
|
corr = compute_correlation_matrix_for_variables(df, VARIABLES, method="pearson")
|
|
|
|
print("Matrice de corrélation (aperçu) :")
|
|
print(corr)
|
|
print()
|
|
|
|
output_path = plot_correlation_heatmap(
|
|
corr=corr,
|
|
variables=VARIABLES,
|
|
output_path=OUTPUT_PATH,
|
|
annotate=True,
|
|
)
|
|
|
|
print(f"✔ Heatmap de corrélation sauvegardée dans : {output_path}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|