# @gaia/downscale

Fine-scale **downscaling & bias correction** (Phase 175.7).

| Module             | Phase     | Contents                                                                                                                     |
| ------------------ | --------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `corrdiff`         | 175.7.1.1 | CorrDiff-class regression UNet + EDM residual-diffusion super-resolution (25 km → 2 km).                                     |
| `station_bias`     | 175.7.1.2 | Per-station bias-correction MLP consuming the 25 km ensemble (CPU-trainable per station); fail-loud registry.                |
| `quantile_mapping` | 175.7.1.3 | Empirical + multivariate (Schaake-shuffle) quantile mapping and derived variables — wind-power density (½ρV³), HDD/CDD, GDD. |
| `urban`            | 175.7.1.4 | Diurnal UHI-aware urban downscaling (~50 m) over Urban-Atlas/OSM imperviousness + vegetation.                                |

Task 175.7.1.1 ("train the CorrDiff model, validated on HRRR/CERRA") needs
paired regional reanalyses and is **not** locally actionable; the architecture
is implemented and its regression stage is overfit-tested. The station-bias task
(175.7.1.2) **is** local — the per-station MLP trains on CPU and its overfit
test recovers a synthetic warm-bias + diurnal signal.

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