polaris.tasks.ocean.horiz_press_grad.finite_volume.hydrostatic_scale

polaris.tasks.ocean.horiz_press_grad.finite_volume.hydrostatic_scale(ds: Dataset) → float[source]

An upper bound on the magnitude of the two hydrostatic terms that cancel in centered_shift().

At 3500 m those terms are each of order 3500 m and they cancel to millimetres or less, so an absolute tolerance says nothing about whether a cancellation is at machine precision. Every round-off assertion against this scheme should be written as a multiple of this scale instead (PGradHighOrder.md §3.7.5).

Parameters:

ds (xarray.Dataset) – The two-column state, as for centered_shift().

Returns:

scale (float) – The bound, in m. Multiply by Gravity / dx to scale a tolerance on an acceleration.