pvtend.ppvi.solver.fill_below_ground

pvtend.ppvi.solver.fill_below_ground(H: ndarray, T: ndarray, U: ndarray, V: ndarray, pr: ndarray = array([1., 0.85, 0.7, 0.5, 0.4, 0.3, 0.25, 0.2, 0.1], dtype=float32)) tuple[ndarray, ndarray, ndarray, ndarray][source]

Fill below-ground NaN so the Wu SOR cores (not NaN-aware) converge.

Pressure-level fields derived from terrain-following model levels (e.g. CESM f09) are genuinely missing where the level lies below ground (1000/ 850 hPa under high terrain or cold high-latitude highs). The Fortran SOR solvers propagate any NaN across the whole 3-D elliptic solve, so the input must be gap-filled first. T, U, V get constant downward extrapolation from the lowest valid level; H (geopotential height) is filled hydrostatically H_k = H_{k+1} + (R_d·T̄/g)·ln(p_{k+1}/p_k) (with p_k > p_{k+1} the height decreases downward).

Cubes are (NL, NY, NX) with level 0 the highest pressure (1000 hPa). Returns the inputs unchanged when there are no NaNs (e.g. ERA5 pressure-level data, which is filled below ground at the source) — so this is a strict no-op on the validated ERA5 path.