polaris.ocean.conservation.compute_total_mass

polaris.ocean.conservation.compute_total_mass(ds_mesh, ds)[source]

Compute the total mass in an ocean model output file

If a pseudo-thickness field is present, a non-Boussinesq approach is used, in which the pseudo-thickness carries the layer mass per unit area (rho_sw * pseudoThickness). Otherwise, the mass is computed from the layer thickness using a constant reference density.

Parameters:
  • ds_mesh (xarray.Dataset) – The mesh dataset, containing areaCell

  • ds (xarray.Dataset) – The dataset containing a layer thickness or pseudo-thickness for a single time slice

Returns:

total_mass (float) – The total mass in kg over the whole domain