polaris.ocean.eos.teos10.ct_from_potential_density

polaris.ocean.eos.teos10.ct_from_potential_density(sigma_0: DataArray | float, sa: DataArray | float) DataArray | float[source]

Compute the conservative temperature that gives a target potential density referenced to the surface.

This is the TEOS-10 counterpart of back-solving a linear equation of state for temperature: it lets a test case specify its stratification as a density profile rather than a temperature profile. Because the reference pressure is zero, the inversion is exact and needs no iteration on pressure.

Only the cold branch of gsw.CT_from_rho is physical for seawater above its density maximum, which is where all oceanographically relevant states lie, so the second root is not returned.

Parameters:
  • sigma_0 (float or xarray.DataArray) – The target potential density referenced to the surface (kg m-3). Note that this is the full density, not the sigma anomaly, so values are near 1027 rather than near 27.

  • sa (float or xarray.DataArray) – Absolute Salinity (g kg-1) at the same points as sigma_0.

Returns:

float or xarray.DataArray – Conservative Temperature (degC), with the dims and coords of sigma_0 if it is a DataArray.

Raises:

ValueError – If any target density is unattainable at the given salinity, which gsw reports as a NaN root. Letting that NaN through would otherwise propagate silently into an initial condition.