42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
# scripts/plot_rain_hyetograph.py
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from meteo.dataset import load_raw_csv
|
|
from meteo.analysis import compute_daily_rainfall_totals
|
|
from meteo.plots import plot_daily_rainfall_hyetograph
|
|
|
|
|
|
CSV_PATH = Path("data/weather_minutely.csv")
|
|
OUTPUT_PATH = Path("figures/rainfall_hyetograph/daily_rainfall_hyetograph.png")
|
|
|
|
|
|
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()
|
|
|
|
daily_totals = compute_daily_rainfall_totals(df=df, rate_column="rain_rate")
|
|
|
|
if daily_totals.empty:
|
|
print("⚠ Aucune donnée de pluie cumule à afficher.")
|
|
return
|
|
|
|
output_path = plot_daily_rainfall_hyetograph(
|
|
daily_rain=daily_totals,
|
|
output_path=OUTPUT_PATH,
|
|
)
|
|
|
|
print(f"✔ Hyétographe quotidien exporté : {output_path}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|