polaris.ocean.vertical.elevation.elevation_range_weights
- polaris.ocean.vertical.elevation.elevation_range_weights(z_interface, layer_mass, min_level_cell, max_level_cell, z_top, z_bot)[source]
Get the mass per unit area of the part of each layer within an elevation range
The range is given in geometric elevation while the integral it weights is in mass, so the geometric overlap thickness
\[w_k = \max\left(0, \min(z^{int}_k, z_{top}) - \max(z^{int}_{k+1}, z_{bot})\right)\]is computed from
z_interfaceand used only as the fraction \(w_k / h_k\) of the layer, which is then applied tolayer_mass. A layer lying entirely within the range therefore contributes its whole mass, and the geometric coordinate enters only through the partial layers at the boundaries.The whole column,
top:bottom, is the one range in which every valid layer is whole, so its overlap fraction is one, noz_interfaceis read and none need be passed.- Parameters:
z_interface (xarray.DataArray or None) – The elevation of layer interfaces, needed for any range but the whole column
layer_mass (xarray.DataArray) – The mass per unit area of each layer, from
polaris.ocean.model.get_layer_mass(). Passing differences ofz_interfaceinstead recovers the purely geometric weights.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
z_top (float) – The upper bound of the range in m, positive up, or
inffor the free surface of each columnz_bot (float) – The lower bound of the range in m, positive up, or
-inffor the seafloor of each column
- Returns:
weights (xarray.DataArray) – The mass per unit area of the overlap of each layer with the range, zero outside the valid layers of a column
- Raises:
ValueError – If a range with a finite bound is asked for without
z_interface