polaris.tasks.ocean.horiz_press_grad.finite_volume.layer_containing_pressure

polaris.tasks.ocean.horiz_press_grad.finite_volume.layer_containing_pressure(pieces: dict, icell: int, pressure: ndarray) → ndarray[source]

The index of column icell’s own layer containing each pressure.

This is the lookup the whole scheme turns on, and writing it as a lookup rather than assuming “edge layer k means column layer k” is the difference between comparing at matched pressure and comparing at matched index. Under tilt the two columns’ layer k span different pressure ranges – at 50 m/km and 64 m layers they are offset by nearly three layer thicknesses and do not overlap at all – so assuming the index is not a small approximation, it is a different scheme, and it is the defect that the previous formulation failed on.

Pressures above the column’s surface or below its floor are clamped to the outermost valid layer, which extrapolates that layer’s reconstruction. Exactness does not depend on this (design §3.5, consequence 3): an extrapolated reconstruction still reproduces a profile it resolves, so the difference is still zero on the exact set. What it costs off the exact set is deliverable D8’.

Parameters:
Returns:

index (numpy.ndarray) – Zero-based layer indices, in [0, maxLevelCell - 1].