# @gaia/gencast

GenCast-class **probabilistic diffusion** forecasting (Phase 175.3). A
conditional EDM diffusion model over +12 h residual fields, using the Phase
175.2 spherical GNN as its score network.

| Module        | Phase     | Contents                                                                                                                                       |
| ------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `edm`         | 175.3.1.1 | EDM preconditioning (c_skip/out/in/noise), loss weight, log-normal training-noise, ρ=7 sampling schedule (σ_min 0.02, σ_max 88).               |
| `denoiser`    | 175.3.1.1 | GNN score network (encoder→multi-mesh processor→decoder) conditioned on the previous two states + noise level, wrapped by EDM preconditioning. |
| `samplers`    | 175.3.1.2 | Deterministic DPM-Solver++(2M) (20-step) and stochastic Heun with Langevin churn.                                                              |
| `ensemble`    | 175.3.1.4 | Batched multi-seed ensemble generation with 12 h autoregressive rollout (15-day, 50-member).                                                   |
| `calibration` | 175.3.2.1 | Fair-estimator CRPS, spread-skill ratio, Talagrand rank histogram, reliability diagram.                                                        |
| `extremes`    | 175.3.2.2 | P99.9 percentile bias, L-moments GEV fit + return levels, empirical (Gringorten) return levels.                                                |
| `clustering`  | 175.3.2.3 | PCA (SVD) + k-means++ scenario clustering with representative members and scenario probabilities.                                              |

Training 175.3.1.3 (1979–2018 ERA5, CRPS vs IFS-ENS on 1320 targets) needs the
full archive and accelerator clusters and is **not** locally actionable; the
model, samplers, and every verification metric it depends on are implemented and
unit-tested here — including a DPM-Solver++ test that recovers the exact
Gaussian marginal from the analytic optimal denoiser, and CRPS values checked by
hand.

```bash
cd libs/gaia/gencast && python3 -m pytest tests/ -q
```
