polaris.ocean.vertical.elevation.apply_vertical_reduction

polaris.ocean.vertical.elevation.apply_vertical_reduction(da, reduction, z_mid=None, z_interface=None, min_level_cell=None, max_level_cell=None)[source]

Reduce a field with a vertical dimension to a horizontal map

Slicing at the sea surface, the seafloor, a layer index or an elevation are cases of one operation: each picks one layer of each column, or the two layers an elevation falls between, for any DataArray. Only the last of them reads the vertical geometry.

Parameters:
Returns:

da_map (xarray.DataArray) – The reduced field, without an nVertLevels dimension, masked where the reduction falls outside the column, and with the attributes of da, since a slice of a field has the field’s units and name

Raises:

ValueError – If the reduction is a range, or if what it needs was not passed