pvtend.ppvi.solver.invert_piecewise
- pvtend.ppvi.solver.invert_piecewise(H_mean: ndarray, T_mean: ndarray, U_mean: ndarray, V_mean: ndarray, H_event: ndarray, T_event: ndarray, U_event: ndarray, V_event: ndarray, zhdr: ndarray, pieces: dict[str, list[int]] | None = None, fill_nan: bool = True, pab: PassABParams | None = None, pc: PassCParams | None = None, pd: PassDParams | None = None) dict[source]
Run the full Wu piecewise PV inversion on a mean + event state.
- Parameters:
H_mean – Mean-state cubes
(NL, NY, NX).H= geopotential height [m];T= raw temperature [K].T_mean – Mean-state cubes
(NL, NY, NX).H= geopotential height [m];T= raw temperature [K].U_mean – Mean-state cubes
(NL, NY, NX).H= geopotential height [m];T= raw temperature [K].V_mean – Mean-state cubes
(NL, NY, NX).H= geopotential height [m];T= raw temperature [K].H_event – Event-state cubes
(NL, NY, NX).T_event – Event-state cubes
(NL, NY, NX).U_event – Event-state cubes
(NL, NY, NX).V_event – Event-state cubes
(NL, NY, NX).zhdr – Wu 8-element header
[lat_s, lon_w, lat_n, lon_e, dlat, dlon, nx, ny]. Works on any regular grid including anisotropic ones (Δlat≠Δlon, e.g. CESM f09): the two spacings are reordered internally to match the Fortran’sHDR(5)=Δlon, HDR(6)=Δlatconvention.pieces – Mapping name → 1-based Wu level list. Defaults to
PIECES.fill_nan – If True (default), hydrostatically gap-fill below-ground NaN in the input cubes via
fill_below_ground()before inverting (required for terrain-following model data such as CESM f09; a no-op on already-filled ERA5 pressure-level data).pab – Solver parameter overrides for passes A/B, C, D.
pc – Solver parameter overrides for passes A/B, C, D.
pd – Solver parameter overrides for passes A/B, C, D.
- Returns:
psi_total(NL, NY, NX)— total balanced ψ′ [m²/s] (event − mean, from the qinvert21 total inversionSI_bal).psi_pieces— dict name →(NL, NY, NX)piecewise ψ′ [m²/s].H_pieces— dict name →(NL, NY, NX)piecewise Φ′ [Wu units].Q_mean,Q_event(NL, NY, NX)— Wu PV (interior K=2..NL−1 valid; boundary levels set toMI).psi_mean,psi_event(NL, NY, NX)— pvpialln ψ [m²/s].SP_pieces/HP_pieces— raw qinvertp block outputs (Wu file units; ψ_phys = SP × 1e5).SI_bal(NL, NY, NX)— qinvert21 total balanced ψ block (Wu file units; ψ_phys = SI_bal × 1e5).
- Return type:
Dict with keys