"""全局配置常量"""
from pathlib import Path

# 项目根目录
ROOT = Path(__file__).parent.parent.parent

# 数据目录
DATA_RAW = ROOT / "data" / "raw"
DATA_PROCESSED = ROOT / "data" / "processed"
DATA_EXTERNAL = ROOT / "data" / "external"

# 输出目录
OUTPUT_MODELS = ROOT / "outputs" / "models"
OUTPUT_FIGURES = ROOT / "outputs" / "figures"
OUTPUT_LOGS = ROOT / "outputs" / "logs"

# 研究城市坐标 (纬度, 经度)
CITIES = {
    "jiaozuo": {"lat": 35.24, "lon": 113.22, "name": "焦作"},
    "zhengzhou": {"lat": 34.75, "lon": 113.62, "name": "郑州"},
}

# ERA5 配置
ERA5_START_YEAR = 2010
ERA5_END_YEAR = 2024
ERA5_VARIABLES = [
    "2m_temperature",
    "2m_dewpoint_temperature",
    "surface_pressure",
    "10m_u_component_of_wind",
    "10m_v_component_of_wind",
    "total_precipitation",
]

# 模型配置
LOOKBACK_DAYS = 14
BATCH_SIZE = 32
LEARNING_RATE = 1e-3
MAX_EPOCHS = 50
EARLY_STOP_PATIENCE = 15
HIDDEN_DIM = 128
LSTM_LAYERS = 2
ATTENTION_HEADS = 4
DROPOUT = 0.3

# 风险等级阈值 (体感温度 °C)
RISK_THRESHOLDS = {
    "low": 32,
    "medium": 35,
    "high": 38,
    "severe": 38,
}

# 时间尺度预测窗口 (天)
PREDICTION_WINDOWS = {
    "short": 3,
    "medium": 7,
    "long": 30,
}

# 确保目录存在
for d in [DATA_RAW, DATA_PROCESSED, DATA_EXTERNAL,
          OUTPUT_MODELS, OUTPUT_FIGURES, OUTPUT_LOGS]:
    d.mkdir(parents=True, exist_ok=True)
