You've already forked donnees_meteo
Réorganisation
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
# scripts/plot_hexbin_explorations.py
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
PROJECT_ROOT = Path(__file__).resolve().parents[3]
|
||||
if str(PROJECT_ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(PROJECT_ROOT))
|
||||
|
||||
from meteo.dataset import load_raw_csv
|
||||
from meteo.variables import VARIABLES_BY_KEY
|
||||
from meteo.plots import plot_hexbin_with_third_variable
|
||||
from meteo.correlation_presets import DEFAULT_HEXBIN_SCENARIOS
|
||||
|
||||
|
||||
CSV_PATH = Path("data/weather_minutely.csv")
|
||||
DOC_DIR = Path(__file__).resolve().parent.parent
|
||||
OUTPUT_DIR = DOC_DIR / "figures" / "hexbin_explorations"
|
||||
|
||||
|
||||
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()
|
||||
|
||||
for scenario in DEFAULT_HEXBIN_SCENARIOS:
|
||||
var_x = VARIABLES_BY_KEY[scenario.key_x]
|
||||
var_y = VARIABLES_BY_KEY[scenario.key_y]
|
||||
var_color = VARIABLES_BY_KEY[scenario.key_color]
|
||||
|
||||
filename = scenario.filename
|
||||
output_path = OUTPUT_DIR / filename
|
||||
|
||||
reduce_func = scenario.get_reduce_func()
|
||||
reduce_label = scenario.get_reduce_label()
|
||||
|
||||
gridsize = scenario.gridsize
|
||||
mincnt = scenario.mincnt
|
||||
|
||||
description = scenario.description
|
||||
print(f"→ Hexbin {var_y.key} vs {var_x.key} (couleur = {var_color.key})")
|
||||
print(f" {description}")
|
||||
|
||||
plot_hexbin_with_third_variable(
|
||||
df=df,
|
||||
var_x=var_x,
|
||||
var_y=var_y,
|
||||
var_color=var_color,
|
||||
output_path=output_path,
|
||||
gridsize=gridsize,
|
||||
mincnt=mincnt,
|
||||
reduce_func=reduce_func,
|
||||
reduce_func_label=reduce_label,
|
||||
cmap="magma",
|
||||
)
|
||||
print(f" ✔ Graphique enregistré : {output_path}")
|
||||
print()
|
||||
|
||||
print("✔ Tous les graphiques hexbin ont été générés.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user