Martin Wright

Generating Realistic Rainfall with Deep Learning

March 2026 Deep Learning • Hydrology • Climate Modeling
Water-supply planning runs on whole-of-system models that are only as good as the rainfall scenarios fed into them - and classic gauge-based generators miss too much of the real spatial and temporal picture to supply good ones. This project asks whether a generative deep-learning model, trained on NIWA's nationwide gridded rainfall data, can do better: learning the shape of a day's rainfall across Auckland's catchments and, once finished, sampling entirely new, physically plausible rainfall futures on demand.

The Problem

Auckland's water-supply system has to be planned as one network, not catchment by catchment - and the system model that tests it is only as good as the rainfall scenarios fed into it. Classic gauge-based generators miss too much of the real spatial and temporal picture to supply those scenarios well.

The Data

NIWA's VCSN grids rainfall across the whole country at roughly 5 km resolution, accounting for the terrain that drives Auckland's catchment rainfall gradients. It is the ground truth this project bias-corrects seven downscaled CMIP6 GCMs against.

The Model

A VQ-VAE-2 compresses each day's rainfall field into a short sequence of codes from a learned vocabulary. Training so far shows it capturing genuinely distinct spatial patterns - finishing it means adding a prior that can sample brand-new sequences from scratch.

The Payoff

A finished generator would produce thousands of spatially coherent rainfall futures on demand - sharpening natural-peril insurance pricing, hydrological stress-testing, and day-to-day decisions like how hard to run the Waikato take each summer.

How complex water supply systems are managed

Auckland's water supply is an integrated network of ten reservoirs across the Hunua and Waitakere Ranges, backed up by a take from the Waikato River when the ranges run low or to preserve storage for upcoming dry period risk. Watercare's planners simulate that whole network together, every reservoir, intake and transfer at once, through the ISMM application - the Integrated Source Management Model.

ISMM behaves similarily to the incentive structure in liberalised energy markets, with New Zealand being no exception to that. Energy sources are ranked into a merit-order "stack" from cheapest to most expensive, and the operator calls on them in that order until supply meets demand. The ISMM water allocation optimisation model runs the same logic over water sources instead of power stations: gravity-fed range water is cheap to use, while the Waikato take is comparatively expensive (due to being constrainedpumping, treatment and consent limits) so the model has to decide how far down that stack to reach without running the cheap storage down too early. You see, if the storage reservoirs are drawn down too quickly, the system loses its buffer against future dry periods, forcing reliance on the expensive Waikato take sooner than desired and leading to an increased risk of a supply shortfall.

Where existing methods fall short

The classic way to generate a long climate sequence is to fit a statistical model to a handful of long-record rain gauges, correlate them pairwise, and resample from that fitted structure. It is a reasonable approach for a small number of fixed points - it is exactly how the companion stochastic rainfall extension project treats three Waikato virtual stations - but it was never designed to describe what is happening at the thousands of locations in between.

Rainfall does not fall in isolated dots at gauge locations - it falls in coherent, weather-system-shaped patches, heavily reshaped by terrain: the Hunua and Waitakere Ranges wring far more rain out of a passing front than the coastal lowlands only a few kilometres away. A handful of pairwise-correlated point series can reproduce the correlation between those specific points, but it cannot tell you what a storm looked like across the catchment as a whole, and it has no mechanism for keeping the generated pattern physically coherent rather than a statistically-plausible but spatially incoherent patchwork.

NIWA's VCSN: A Rainfall Grid for the Whole Country

NIWA maintains the Virtual Climate Station Network (VCSN), a roughly 5 km grid covering the whole of New Zealand, interpolated from the physical climate station network using methods that explicitly account for elevation. That matters here specifically because of terrain: a naive distance-based interpolation would smear the sharp rainfall gradient between the Hunua/Waitakere Ranges and the surrounding coastal plain into a flat average, while a terrain-aware grid preserves the orographic enhancement that drives those ranges' catchment yield.

Stochastic Spatial Climate Intelligence

Put VCSN-grounded, bias-corrected rainfall fields in front of a VQ-VAE-2 model: an encoder squeezes each day's 60 by 60 rainfall field down to a short sequence of discrete codes drawn from a learned vocabulary of 512 entries, captured at two levels of detail (a coarse pattern and a finer correction on top), and a decoder reconstructs the field from those codes alone. Explore what it has learned to represent below - hover a point to see the rainfall pattern behind it.

Latent Space Explorer

500 encoded days are projected to 2D with PCA - nearby points are days the model treats as similar. Hover any point to decode its code sequence back into a rainfall map.

PCA 2
PCA 1
Hover a point
← select a point
Dry
Wet

To validate, the model is asked to reconstruct real days it has already seen which is useful for checking the codes capture different weather regimes.

Generation involves sampling a code sequence conditioned on day-of-year and recent history, and decoding it into a brand-new rainfall field never observed in the trained record over and over again. Every catchment on the grid is decoded from the same sampled sequence, so the result is spatially co-variant by design. This is how "spatial climate intelligence" improves over a plain weather generator - thousands of physically coherent rainfall futures, generated on demand, to stress-test a system model against.

Applications: Pricing Risk, Modelling Floods, and Running the Waikato Harder

Natural-peril insurers pricing flood and drought-linked risk need a large, representative sample of plausible loss events in excess of what is available in the typical historical record (50-to-170 years depending on the area). The companion project on stochastic rainfall extension shows how short that record really is. A generative spatial model that can be resampled by the thousand gives actuaries a far richer basis for setting risk premia than a historical event catalogue alone, particularly for the correlated, regional events that drive the worst outcomes.

Furthermore, the same generated ensembles feed directly into hydrology: running thousands of synthetic rainfall sequences through a rainfall-runoff or reservoir simulation model stress-tests flood response, drought drawdown, and consent compliance across a far wider range of plausible futures than the single future that happened to occur.

Finally, the most direct potential application loops back to the liberalised energy market. An electricity operator with a reliable demand forecast decides in advance how far down the generation stack to dispatch; a water utility with a reliable, probabilistic view of how dry the summer ahead is likely to be could do the same with its sources - deciding early how hard to run the comparatively expensive Waikato take versus holding it in reserve, easing off before restrictions bite when the outlook is wet, and leaning on it earlier when it is not. That forward-looking, probabilistic operating posture is only possible with a model that can generate many plausible near-term rainfall trajectories on demand - which is the practical promise of this project once it is finished.