Frame quality¶
dpc_radar.quality ¶
What to trust in a frame, pixel by pixel, and why.
:meth:dpc_radar.RainGrid.quality looks at a frame from four sides. Each one
is a rule a person can check, with a threshold measured on the frames kept from
June to November 2026, and each names the pixels it does not trust:
jump: the frame against the one before it (:meth:RainGrid.check). The only side that can reject the whole frame; it needsprevious;beyond_record: more rain than was ever measured in Italy over the same window (:data:RECORDS, with a margin). It needs nothing, so it also works on the first frame;outlier: a pixel far above the 5x5 pixels around it, measured with their median and their spread (MAD): a hot pixel, not a storm;gauge_only: in a «Merging» frame, rain that the radar alone did not see at all, at a place where the radar sees well. It needsradar, the radar-only rain over the same window. That is a rain gauge reporting rain under a dry sky: on 6-8 October 2026 one of them put 126.6 mm in every three-hour frame for 33 hours on the Lazio-Abruzzo border.
There is no trained model here. Fourteen labelled cases are too few to train one, and a rule that can be read is worth more than a model that cannot be checked: the rules above are the features a model would use, when the labels exist. Two features of the first plan are missing because we have no confirmed case to measure them on: radial symmetry around a radar and rain over the sea against the nearby land. The one case we had, the "disks" west of Sardinia of 20 October 2026, turned out to be rain.
What it cannot see: a wrong value that is plausible, moves like rain and agrees with the radar; a gauge that fails where the radar is blind (there the gauge is all we have, and it is kept); a gauge that reads too little.
Quality
dataclass
¶
The answer of :meth:RainGrid.quality.
grid is the frame to use, with the pixels of mask set to NaN;
None when the whole frame is rejected. mask is True where a
pixel that had a value is not trusted. reasons counts those pixels by
the rule that named them (a pixel can be under more than one). score
is the share of the wet pixels that are trusted: 1 for a clean frame, 0
for a rejected one. verdict is the answer of the comparison with the
frame before, None without one.
record_ceiling ¶
record_ceiling(hours: int | None) -> float | None
The value no frame of this window should pass (mm); None for an intensity.
radar_total ¶
radar_total(frames: list[RainGrid]) -> RainGrid
The radar-only rain over a window: the sum of its hourly SRT1 frames.
For a CUM3 issued at t, the frames of t, t - 1 h and t - 2 h.
Where one hour has no data, the sum has none (NaN).
Pass every hour of the window: with one missing the sum is short, and rain
the radar did see would look like rain it did not.
quality ¶
quality(grid: RainGrid, previous: RainGrid | None, radar: RainGrid | None, *, max_step: float, min_pixels: int) -> Quality
See :meth:dpc_radar.RainGrid.quality.