Closes #3681 (section 3, more internal-consistency relations). Section 1 landed …in #3782, section 2 in #3795; the one relation of the issue left out is the optional sum of parts, which the maintainer decided not to build (2026-11-05). Nothing else in the issue is open.
## What changed
The new check `relations` holds the readings of **one row** (same station, same timestamp, same file: a dataset the provider collects whole) to each other, on **every observation network** that has two parameters of its table in one dataset. It is a check of its own and **not `consistency`**: `consistency` keeps the rules a provider hands the core for its own source (DWD road, Météo-France), flags the one reading the rule names and stays **hard** by default; `relations` is one table for every provider, flags **both** readings of a broken pair and is **soft** by default. Neither changes what the other does. The page has the table and a section on which to set.
| relation | tolerance | source |
| --- | --- | --- |
| maximum >= mean >= minimum, for every triple of a dataset (air temperature at 2 m and 5 cm, relative humidity, site and sea level pressure); a maximum and a minimum are held to each other where the mean is no reading. **Not for the daily temperatures of Météo-France, nor FMI's daily mean** (the windows differ, below) | none | WMO-No. 100 3.3.6, Durre et al. 2010, ECA&D, Vejen et al. 2002 |
| dew point <= air temperature | 0.2 K | Vejen et al. 2002 (gamma 0.2 recommended); Zahumenský 2004, HadISD, MADIS take 0 |
| gust >= mean wind of the same interval (`wind_gust_max`/`wind_speed_mean`, `..._last_10min` pairs), highest rolling mean >= mean and >= lowest | none | Zahumenský 2004 (II.c); own derivation for the rolling means |
| sunshine <= day length at the station's position and date | +5 % (ECA&D, D5) | WMO-No. 100, ECA&D; own derivation for the day length (below) |
- **Which reading is flagged**: both of a violated pair; for a triple those of the broken pair (a maximum below the mean flags the maximum and the mean, not the minimum); the one sunshine reading of a day.
- **Soft by default** (`suspect:relations`, value kept), `hard` nulls both as `rejected:relations,raw:<text>`; covered by `plausibility="soft"|"hard"`, `Options`, `WD_TS_PLAUSIBILITY__RELATIONS`, `--plausibility-relations`, `plausibility_relations` in REST and MCP. Additive (`### Added`). As for every suspect value, interpolation, summaries, stripes and `skip_empty` leave a flagged reading out, so a good reading beside a wrong one leaves them too (migration table row added).
- A check never downloads: the relation stands aside for a null, a code of the source and any reading another check judged bad (soft or hard); a relation across two files is not judged; a dataset collected a parameter at a time (SMHI, WSV, EA, Hub'Eau) has none. The partner of a relation is read beside the parameter you asked for, as the air beside a road surface is.
- **The day length** reuses the sun position of the road rule (#3669), moved to `model/sun.py`, and adds the longest day length of the date (the day, the day before, the day after: the source's clock is not always UTC, and near the polar circles the day moves by hours), the refraction and disc (-0.833 degrees) and the dip of the horizon of a summit (1.76' times the root of the elevation: the plain day put 6 readings of the Zugspitze and the Feldberg above 5 %, with the dip 1). A station without a position, 0/0 or off the globe is stood aside for.
## Evidence
Real data read 2026-11-05: DWD open data, historical and recent merged, whole histories, 10 stations per resolution (Dresden-Klotzsche, Hamburg, Potsdam, Zugspitze, Helgoland, Arkona, Feldberg, Berlin-Tempelhof, Straubing, Trier-Petrisberg). "Judged" are the pairs (or sunshine readings) with both values and that no other check found bad; "broken" are pairs (twice that many flagged readings).
| resolution | relation (dataset) | judged | broken | what they are |
| --- | --- | --- | --- | --- |
| daily | max >= mean, mean >= min of the air temperature (`climate_summary`) | 321,379 / 321,375 | 0 / 0 | |
| daily | gust >= mean wind (`climate_summary`) | 208,959 | 2 | Zugspitze 1994-08-10 (mean 10.3 m/s, gust 8.7), Dresden-Klotzsche 1994-05-01 (4.9 beside 4.8): real inconsistencies |
| daily | sunshine <= day (`climate_summary`, `solar`) | 306,534; 94,005 | 1; 0 | Zugspitze 1919-11-04: 11.0 h on a day of 10.28 h at the summit (limit 10.8). Without the horizon dip: 6 (5 Zugspitze, 1 Feldberg) |
| hourly | dew point <= air + 0.2 K (`dew_point`) | 4,513,204 | 398 | 354 at the Zugspitze, Feldberg, Trier, 1940s to 2000: 116 by more than 5 K (sign or digit: -30.0 beside 32.0), 80 by 1 to 5 K, 174 by 0.5 to 1 K (169 by exactly 1.0 K, 166 before 1981, whole degrees), 28 by 0.2 to 0.5 K |
| hourly | dew point <= air (`moisture`) | 4,501,288 | 0 | derived by DWD |
| hourly | sunshine <= day (`sun`) | 4,905,458 | 0 | |
| 10 min | dew point <= air + 0.2 K (`temperature_air`) | 15,470,302 | 925 | **912 of 928 are at a relative humidity of 100 %** (Arkona 727, Potsdam 190): a saturated hygrometer's dew point reads 0.2 to 1.0 K above the thermometer beside it (617 by 0.2 to 0.5 K); 9 by more than 5 K (72.8 °C beside 24.4, Dresden 1992) |
| 10 min | max >= min at 2 m / 5 cm (`temperature_extreme`) | 16,286,918 / 5,388,500 | 42 / 1 | Helgoland 26 on 2008-12-01 (up to 0.8 K), Straubing 14 (0.2 K) |
| 10 min | highest >= lowest rolling mean (`wind_extreme`) | 9,821,075 | 5 | |
| 10 min | sunshine <= day (`solar`) | 15,906,485 | 0 | |
**Météo-France and FMI: the daily mean is not of the window of the extremes (found by the review, now measured).** `meteofrance/observation daily/core`: TM is the "moyenne quotidienne des températures horaires", the description of the fields gives no window for TN and TX (it gives one for the rain only), and at Bordeaux-Mérignac (33281001), 2023-12-01, TX 9.3, TM 8.3, TN 8.5 are all good (TN is the lowest value from 18 UTC the evening before to 18 UTC; the hourly series falls to 5.8 °C by 23 UTC). Over the 36 stations that still report, 2019 to 2025 (128,796 rows): TM below TN on 6 of 17,565 days, above TX on 2 of 17,563 (the review: 9 of 32,646 at 7 stations); TX against TN holds on 20,312 days, but no window is given that makes it hold, so **the whole daily temperature ladder of `meteofrance/observation daily` is left out** (the hourly TX/TN "within the hour" stay: 10,454 pairs, 0 broken; the gust against the mean wind stays: 5,555, 0 broken). FMI (`opendata.fmi.fi/meta`): `tday` has aggregation period P1D, `tmax` and `tmin` PT24H, two periods of the source's own naming; 40 stations, 2010 to 2023 (295,204 rows): TM against TN 3 of 65,316 days broken (0.1 K), TX against TM 0 of 65,317. **FMI's mean is left out; its maximum against its minimum, both PT24H, stays** (21 days judged where the mean is null, 0 broken; Sodankylä 2012-11-12 is one of the 3). The exceptions are `NOT_ONE_WINDOW` in `model/relations.py`, listed on the page with these numbers.
Other key-less networks, a random sample of up to 40 stations still reporting (daily 2019 to 2023 unless stated):
| network, resolution | relation | judged | broken |
| --- | --- | --- | --- |
| Météo-France SYNOP, 40 stations, 2023 to Oct 2025 | dew point against air; gust against mean of ten minutes | 126,344; 87,708 | 0; 0 |
| NWS, 40 stations, one week | dew point against air | 3,841 | 0 |
| DMI daily | TX/TM; **TM/TN**; humidity and pressure triples; gust and rolling mean against mean | 7,138; 7,138; 3,523 and 3,556; 6,647 and 6,651 | 0; **14**; 0; 0 |
| MeteoSwiss daily, 40 stations | triples at 2 m and 5 cm; gust; sunshine | 67,438; 36,443; 69,170; 51,333 | 0 |
| Geosphere daily, 18 stations | max, (max+min)/2, min; gust against mean; sunshine | 18,161; 18,140; 15,209 | 0; **13**; 0 |
| CHMI, RMI, IMGW synop daily | triples; sunshine | 3,652; 23,712; 5,478 (sunshine 3,651; 21,305) | 0 |
DMI's 14 are one station (Vestervig, 06051): a mean up to 2.2 K below the lowest hourly value of the day, which the source defines over the same hours (kept: a real inconsistency). Geosphere's 13 are one station (15300): a gust 0.2 to 0.3 m/s below the daily mean wind. Also 0 broken, from the first look at 2023 (two stations each): Geosphere hourly and 10 minutes, RMI hourly sunshine, FMI Sodankylä hourly (8,734 gust/mean of ten minutes, 8,737 dew points), MeteoSwiss hourly, ECCC hourly (8,731), DMI hourly (697), GHCN-Daily 2018 to 2023 (62,144 days of TMAX against TMIN at six ASOS stations, 40 cooperative stations with observers at different hours and three European ones; 13,101 days of the humidity triple at the ASOS stations), DWD POI (100 dew points, 25 sunshine readings). DWD road, one day: 3,750 dew points, 7 broken (station O329: a dew point of 2.3 beside an air of 1.6). **Not measured**: the keyed providers (KNMI, MET Norway, Met Office, AEMET), IMGW `climate` (no rows for the stations asked), GHCN-Daily's mean air against mean dew point (no station of the sample reports both; in the table and unmeasured there, as decided), a sunshine duration at a polar station (no key-less one reports it; Tromsø is tested against the Almanac).
**What I got wrong the first time.** The PR body said that Météo-France and NWS "returned no readings" and that the keyed providers needed a key. Météo-France and NWS are key-less. My loader chose two stations by rank near a point and a window (Paris-area stations for 2023; NWS keeps about a week, and I asked for June 2023), got 0 rows, and I wrote that as a fact about the sources instead of checking my selection. Redone with stations drawn from the list of those still reporting and windows each source has: the table above and the Météo-France findings.
**False alarms and traps, measured rather than assumed:**
- **Rounding of the mean against max or min**: no violation in 321,379 DWD days; a rounding is monotone, so it cannot break an order.
- **Max and mean from different windows** (climate day, 06-06 window, terms): DWD daily 0 broken of 321k and GHCN-Daily cooperative stations (observers at different hours) 0 of 44,638 days, **but Météo-France's TM against TN breaks on 6 of 17,565 days and FMI's on 3 of 65,316 (the review's catch): by the source's definition the windows differ, so those ladders are left out, not loosened.**
- **Gust against mean of different intervals**: only pairs the canonical names pair are judged (not an hourly gust beside `wind_speed_mean_last_10min`). **DWD's 10-minute highest rolling mean of the wind is above the gust in 1.4 % (137,356 of 9.8 million)**, by 0.1 to 0.5 m/s in most (11,709 above 0.5, 2,371 above 1, 8 above 5 m/s): the rolling window begins before the interval, so the order does not hold by the source's definition. **Listed as not judged with this reason, not loosened.**
- **Calm wind**: gust 0 beside mean 0 is no violation (the order is not strict).
- **Dew point near saturation with whole-degree rounding**: see the table: at 10 minutes 912 of the 928 pairs above 0.2 K sit at a humidity of 100 %; **this is the false-alarm class** and it costs both readings (0.006 % of the readings). A 0.5 K tolerance would remove 617 of the 928 and keep 311; I kept the sourced 0.2 K (below, for the maintainer).
- **Sunshine near the polar day**: no key-less data; tested on synthetic days against the Almanac (Tromsø 0 h at the December solstice, 24 h at the June one, and a date one day off).
- **Wrong station positions**: 0/0, a missing position and a number off the globe are stood aside for; a position on Earth but wrong is not seen: a degree of latitude moves the December day by 0.13 to 0.22 h at 45 to 55 degrees north (the margin is 0.4 to 0.9 h) and the June day at 65 degrees by about 2 h.
## The effect on `step`
`relations` runs before `step`, which treats a reading any other check judged bad as no neighbour; a reading `relations` flagged is therefore no neighbour either, and can hide a real spike and move its flag. Measured on the 10 stations' whole histories, the same code with and without the check:
| dataset | `relations` flagged readings | `step` flags before | after | lost | gained |
| --- | --- | --- | --- | --- | --- |
| hourly `dew_point` | 796 (398 pairs) | 991 | 944 | 47, all at readings now `suspect:relations` | 0 |
| 10 minutes `temperature_air` | 1,850 (925 pairs) | 738 | 732 | 6: 4 now `relations`, 2 at Arkona 1993-09-11 11:50 next to a flagged neighbour | 0 |
| daily `climate_summary` | 5 | 0 | 0 | 0 | 0 |
| hourly `moisture` | 0 | 1,538 | 1,538 | 0 | 0 |
No flag of `step` moved to a good reading in this data. The mechanism exists and is pinned by a test (an hourly series 10, 10, 10, 45, 10 with a maximum of 5 beside the third mean: the 45 is not judged, the 10 after it is flagged `suspect:step`), and the page states it as a caveat, as for `stuck`.
## Timing
`values().all()` of DWD files from the cache, median of 3 runs, the table of relations patched empty (off) and as shipped (on); run noise is about 3 %:
| scenario | readings | off | on |
| --- | --- | --- | --- |
| hourly/moisture, 1 station | 3,604,307 | 2238 ms | 2241 ms (+0 %) |
| hourly/dew_point, 1 station | 1,032,059 | 1081 ms | 1060 ms (-2 %) |
| hourly/sun, 1 station | 511,050 | 443 ms | 489 ms (+10 %) |
| 10_minutes/temperature_air, 1 station | 8,089,649 | 6286 ms | 6082 ms (-3 %) |
| 10_minutes/temperature_extreme, 1 station | 5,549,085 | 3995 ms | 4112 ms (+3 %) |
| 10_minutes/solar, 1 station | 4,348,298 | 3422 ms | 3547 ms (+4 %) |
| daily/climate_summary, 1 station | 451,082 | 283 ms | 290 ms (+3 %) |
| daily/climate_summary, 10 stations | 4,176,632 | 2678 ms | 2867 ms (+7 %) |
Single-parameter requests (the review found that a request reading no partner still paid for every relation's: +31 % and +12 %; `read_beside` now reads a partner only for a parameter that is in the relation):
| scenario | readings | off | on |
| --- | --- | --- | --- |
| hourly/moisture/humidity_absolute (in no relation), 1 station | 514,885 | 978 ms | 935 ms (-4 %) |
| 10_minutes/temperature_air/pressure_air_site (in no relation), 1 station | 1,630,848 | 3366 ms | 3155 ms (-6 %) |
| hourly/moisture/temperature_dew_point_2m (reads the air beside it), 1 station | 514,885 | 1008 ms | 1229 ms (+22 %) |
| daily/climate_summary/temperature_air_max_2m (reads the mean and the minimum), 1 station | 33,181 | 164 ms | 183 ms (+12 %) |
(The first version computed the day length for every reading: 10-minute `solar` +15 %; it is now computed once per date.) **On the offline fixtures**: over the 5,264 offline tests of `tests/provider` and `tests/model` the check ran 4,518 times on 614,175 readings, 8.5 s in all (1.9 ms a frame, the fixed cost of polars: a frame of the fixtures has 136 readings), against 6.4 s for `step` and 4.5 s for `stuck`'s run judge over the same frames.
## Tests
`tests/model/test_relations.py` (107 tests, both modes): **every relation of every dataset that has one** (derived from the metadata) at its limit, at its tolerance and just beyond (both readings flagged, nothing else); the triple (the broken pair only, the maximum against the minimum where the mean is no reading, equal readings, `0.1 + 0.2`); a null, a code (`raw:`) and a partner `range` rejected (soft, hard, and `range` soft) stand aside; different timestamps; hard (`rejected:relations,raw:12.5`, both nulled) and soft; a bare `hard`; a forecast; dew point at and beyond 0.2 K and at whole degrees; gust below the mean, a calm, the rolling mean not held to the gust, an hourly gust beside a mean of ten minutes, the pair of ten minutes; the day length against the Almanac (Hamburg, the equator, Tromsø polar night and day, a summit, a date one day off); sunshine at the limit and beyond, hard, the polar night and day, a summit, an elevation that is no height, no usable position (None, 0/0, off the globe, NaN), hourly; a dataset collected a parameter at a time and a forecast have none; the interaction with `step` (a relation-flagged reading is no neighbour; the hidden spike is pinned); a random-series test of 12 seeds against a reading-by-reading judge. **Since the review: a sunshine stub beyond the day (the real Zugspitze day of 1919-11-04 at its position and 2,956 m, soft and hard), a test that the station's elevation reaches the horizon dip (on `daily/solar`, which has no pressure that would read the elevation anyway), the Météo-France and FMI exemptions, a single-parameter request (judged through its partners) and one for a parameter in no relation (reads no partner). **Each of the three plumbing mutations the review made fails now** (`position = None`, `needs_elevation = plan.pressure`, dropping the partners in `read_beside`), and so does reading every relation again. A mutation run of 17 edits** (`gt` for `ge`, only one reading flagged, the skip pair beside a mean, a partner another check judged bad, sunshine inverted, no elevation, no margin, 0/0 a place, no position check, tolerance 0 and 0.5, the gust held to the rolling mean, the instantaneous air as a mean, months judged, one day only, no horizon dip) is killed by the tests. `tests/test_docs_plausibility.py` holds the coverage rows (`*` for `relations`, derived from the table and the metadata, a second derivation from the plan) and the soft default; `tests/model/test_relations.py` holds the page's table to the code; two DWD value stubs name the tokens (the real day of Dresden-Klotzsche 1994-05-01, mean wind 4.9 m/s beside a gust of 4.8: `suspect:relations` on both, `rejected:relations,raw:4.8` and `raw:4.9` hard).
**Frames snapshot diff**, read (twice): six entries for the two new dew/wind stubs, six more for the two sunshine stubs, and **one existing frame changed**: `test_metno_frost_sunshine_duration_is_read_as_hours[daily...]`, whose fixture served 10.4 hours of sunshine on 2020-01-01 at Oslo (a day of 6 hours: a number no sunshine recorder produces). It is a test of the unit (hours, not seconds), so its date moved to 2020-06-01 (a day of 18.7 hours), with the same 10.4; the test's id is unchanged. No other offline fixture's frame changes. The OpenAPI and CLI help snapshots are regenerated (`plausibility_relations`, `--plausibility-relations`, additive); no release baseline is touched. `test_dwd_road_weather_the_sun_stands_where_the_observatory_puts_it` now imports `sun_elevation` from `wetterdienst.model.sun`, where the road's sun moved (no change of the function).
Runs on the final head: `uv run poe format`, `lint` and `typecheck` clean; `uv run poe "contracts:snapshot"`: nothing to change after the merge of #3797 (the OpenAPI snapshot is regenerated and equal); `uv run poe "frames:snapshot"`: the diff above; `uv run poe "test:offline"` **without the docs group** (the venv synced with `uv sync` and the testing flavour's extras only): 13,000 passed, 46 skipped, 0 failed (6 min 47 s); with the docs group, the offline selection minus the `cflake` tests, in parallel: 13,081 passed, 3 skipped, 0 failed; `uv run poe docs` builds without a Sphinx warning.
## CI
The old head (`a0b4821`) failed `Minimum dependency versions`, `Python 3.14 on OS windows-latest` and the Ubuntu 3.11, 3.12, 3.13, 3.15 jobs in "Run tests" (the rest were still queued). **None of the failures comes from this PR.** Their failed tests are the same set that `main` fails at `31f0371` (the run before this PR, reported "success" because the matrix is `continue-on-error`): `tests/provider/metno/frost/test_api.py::test_metno_frost_values_6hour_fallback` (`assert 0 == 2`), the three live MeteoSwiss catalogue tests `test_a_live_catalogue_has_its_data[meteoswiss/observation ...]` (`data_orphan: station 'MLJ'`: a data file the catalogue does not list), and `test_api_aemet_observation` and the AEMET catalogue tests (`CredentialRejectedError`: no valid key in CI). All are remote tests; every "Offline selection" job of `main` and the Offline selection jobs of this PR pass. (Read from the logs of jobs 127463943305, 127463942737 and 127463943528.)
## For the maintainer
Settled by the maintainer: the 0.2 K tolerance stays, and so does the GHCN-Daily mean air against mean dew point (unmeasured there, said above and on the page).
1. **Météo-France's daily TX against TN** is left out with its means, because no window is given that makes it hold (it held on 20,312 of 20,312 days measured). If you know from Météo-France's documentation that TN and TX share the hours of a day, one line of `NOT_ONE_WINDOW` brings it back.
2. **A gust is not held to the highest rolling mean of ten minutes** (137,356 of 9.8 million at DWD). Not built; it would need a tolerance no source gives.
3. **The maximum and the minimum are held to each other where the mean is null** (GHCN-Daily has TAVG for few stations): my reading of "the violated pair" when the third reading is missing.
4. **Hourly and 10-minute sunshine** is also held to the day, which only the polar night can break.
5. **Two real inconsistencies kept as findings, not exempted**: DMI Vestervig (14 days of mean below minimum) and Geosphere station 15300 (13 days of gust below the mean).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0187kUCUFKYgEkY8mDbH23V8