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:
da (xarray.DataArray) – The field to reduce, with an
nVertLevelsdimensionreduction (VerticalReduction) – How to reduce it, from
parse_vertical_reduction()z_mid (xarray.DataArray, optional) – The elevation of layer midpoints, needed only to interpolate to an elevation
z_interface (xarray.DataArray, optional) – The elevation of layer interfaces, as for
z_midmin_level_cell (xarray.DataArray) – The zero-based index of the topmost valid layer of each column
max_level_cell (xarray.DataArray) – The zero-based index of the bottommost valid layer of each column
- Returns:
da_map (xarray.DataArray) – The reduced field, without an
nVertLevelsdimension, masked where the reduction falls outside the column, and with the attributes ofda, 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