Day 4 methods: rain regions and "Same gauges, two questions"
Robert Berry, Geodat AI Ltd. Rebuilt 6 November 2026.
This note covers both Day 4 maps: "A map of Wales drawn by rain" (part 1) and "Same gauges, two questions" (part 2). It explains the data, the method, how robust the result is, and what changed from the versions first posted on 3 and 4 November.
Why the maps were rebuilt
On 3 November, while making part 2, I found two faults in the daily rainfall archive that the RiverPulse pipeline builds from Natural Resources Wales (NRW) records:
- Dry days are stored as blank, not 0 mm, even when every 15-minute reading that day is good. About half of all gauge-days are blank.
- Some gauges have whole years of 0 mm (or close to it) that are still flagged as good data. These are broken or stuck gauges, but nothing marks them as faulty.
Part 2 was built with a workaround for both. Part 1 had been built a day earlier, and the step that calculated its correlations was not saved as a script, so I could not show exactly how it handled the faults. Both maps have now been rebuilt from one saved pipeline, so every number below can be reproduced.
Data
- Rainfall: NRW daily rainfall records, 1 January 2009 to 31 December 2024, from the RiverPulse archive (rainfall-daily.parquet). Open Government Licence.
- Gauge locations: National Grid references from the archive manifest (204 rain gauges).
- Height: OS Terrain 50 (50 m grid), sampled at each gauge. Contains OS data © Crown copyright and database right 2026.
- Rivers and coastline on the maps: OS Open Rivers and the Day 3 coastline.
Cleaning the data
- A blank day counts as 0 mm when at least 90% of that day's 15-minute readings are good. Otherwise it stays missing.
- Broken gauge-years are removed. For each gauge and year I worked out the share of days with at least 0.2 mm of rain, and compared it with the median of the six nearest gauges that year. If a gauge had under half its neighbours' share of wet days, or fewer than 60 valid days, that year was removed. This removed 327 gauge-years across 110 gauges.
- Gauges with under three years of usable days were left out (3 gauges). That leaves 201 gauges.
In the first version, nine gauges were left out because none of their neighbours matched them well. After cleaning, every gauge matches at least one other gauge with a correlation of 0.81 or more, so none needed leaving out. Their weak matches were caused by the faults.
Part 1: rain regions
- Similarity: for every pair of gauges, the Pearson correlation of daily totals, using days when both have data (at least 365 shared days).
- Clustering: Ward's hierarchical clustering on 1 minus the correlation, cut at eight groups.
- Region names describe where each group's gauges are. They are labels, not official areas.
- The coloured background blends each gauge's likeness to every region (its average correlation with that region's gauges), spread smoothly over 11 km. It shows that the edges between regions are soft.
- The 97% figure: the share of gauges that are in the same region as their nearest gauge.
| Region |
Gauges |
Typical stability |
| Ynys Môn (Anglesey), Llŷn, west Eryri |
24 |
99% |
| Clwyd and the north-east |
15 |
100% |
| The northern uplands |
28 |
93% |
| Powys and the border |
20 |
84% |
| Ceredigion and the Cambrian Mountains |
25 |
48% |
| Sir Benfro (Pembrokeshire) |
15 |
95% |
| Bannau Brycheiniog (Brecon Beacons), the Valleys and Swansea |
49 |
68% |
| Caerdydd (Cardiff) and Gwent |
25 |
88% |
Typical stability is the median, across a region's gauges, of how often each gauge lands in that region in 100 reruns (see below).
How robust part 1 is
- 100 reruns on resampled years: each rerun draws 16 years at random (with repeats) and redoes the whole clustering. 93 of 201 gauges land in the same region at least 90% of the time. 26 switch region in more than half the reruns, and these are ringed on the map. The median agreement between a rerun and the map is 0.62 on the adjusted Rand index (0 is chance, 1 is identical).
- Other ways of measuring similarity: using log rainfall changes the region of 50 gauges, and rank correlation changes 44. The northern regions, Pembrokeshire and Cardiff and Gwent hold up throughout. The boundaries between Ceredigion, the Valleys and Powys move.
- Split by time: 2009 to 2016 on its own changes 50 gauges, and 2017 to 2024 on its own changes 62. Same pattern: the north holds, and mid and south-west Wales move.
- Number of groups: eight is about as stable as any cut between 4 and 11 (median agreement 0.65 at eight, 0.51 to 0.68 elsewhere).
What holds up: neighbouring gauges share weather, the first split is the south and west against the north, and the northern regions, Pembrokeshire and Cardiff and Gwent are solid. What is softer: the exact lines between Ceredigion and the Cambrian Mountains, the Valleys and Powys.
What changed from the first version of part 1
- 201 gauges instead of 187.
- Agreement with the first version is 0.66 on the adjusted Rand index (184 gauges in both). Most regions match one to one.
- The first version's "Pembrokeshire and the west" took in the south Ceredigion coast (Aberporth, Llechryd, Rhydlewis, Ferwig, Llanina). Those five now join Ceredigion, and Pembrokeshire is a region on its own.
- The first version's "Cambrian Mountains" is now "Ceredigion and the Cambrian Mountains". It reaches the coast, and is the least settled region. Five gauges on its southern edge (around Llanymddyfri (Llandovery), Myddfai and the upper Usk) moved to the Bannau Brycheiniog and Valleys region.
- "Eryri and the uplands" is now "The northern uplands", the same gauges give or take one or two. The name changed because the region also reaches Llyn Efyrnwy (Lake Vyrnwy) and Llangurig.
- Unsettled gauges are now picked out by the 100 reruns. Before, they were gauges whose average correlation with another region was almost as high as with their own.
Part 2: same gauges, two questions
- Gauges: the 176 of the 201 with at least three clean years (330 or more valid days and 100 or more wet days) and steady totals (year-to-year coefficient of variation under 0.4; higher values point to faults).
- How much: the average yearly total over clean years. Ward clustering on that single number, cut at eight groups and numbered from driest to wettest. Range: 585 mm (Colwyn Bay) to 3,188 mm (Cwm Dyli, beneath Yr Wyddfa).
- When: the part 1 regions.
- Nearest-neighbour agreement: 97% by timing, 36% by amount (it was 92% and 38%).
- Agreement between the two groupings: 0.05 on the adjusted Rand index (it was 0.07).
- Height against amount: a correlation of 0.51 (it was 0.53).
Limits
- Eight groups is a choice. The method finds structure at any cut, and a different number would draw different lines.
- Correlation compares wet and dry days. It says nothing about totals, and big storms that hit everywhere push correlations up.
- The fault checks catch whole years that read too dry. They won't catch a gauge that under-reads by a smaller amount, or short dropouts within a year.
- Gauges aren't spread evenly. They cluster in the Valleys and around reservoirs and are sparse in the Cambrian Mountains, which is partly why that region is the least settled.
- Region names are my descriptions, not official areas.
Files
Scripts are in C:\geodat\pipeline-work\riverpulse\30daymap-2026\day04-clusters\rebuild-2026-11-06:
- build.py: cleaning, correlation and clustering (part 1)
- robust.py: reruns and the alternative similarity measures
- kchoice.py: stability for different numbers of groups
- amount.py: yearly totals and amount groups (part 2)
- render4.py and render4b.py: the two maps
- clusters.csv, amount_groups.csv, removed_gauge_years.csv, summary.json, robust.json: outputs
Images are in OneDrive\01_Projects\008 - RiverPulse\30DayMapChallenge 2026\day04-clusters. The full-size PNGs (4320 × 5400) are in _full-size.