polaris.ocean.vertical.elevation.get_valid_level_range

polaris.ocean.vertical.elevation.get_valid_level_range(ds)[source]

Get the zero-based indices of the topmost and bottommost valid layer of each column

Both models write minLevelCell and maxLevelCell with the one-based indexing of MPAS-Ocean’s Fortran, so this is the one place that converts them to the zero-based indices the reductions use.

A data set with no minLevelCell has no ice-shelf cavities, so the topmost valid layer is the topmost layer of the grid.

Parameters:

ds (xarray.Dataset) – The vertical coordinate, with MPAS-Ocean names

Returns:

  • min_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

Raises:

ValueError – If the data set has no maxLevelCell, without which a column has no seafloor