All functions¶
The following section documents all functions alphabetically.
This is a Python implementation of the Gibbs SeaWater (GSW) Oceanographic Toolbox of TEOS10. Extensive documentation is available from http://www.teos10.org/; users of this Python package are strongly encouraged to study the documents posted there.
This implementation is based on GSWC for core functions, with additional functions written in Python. GSWC is the work of Frank Delahoyde and Glenn Hyland (author of GSWFortran, on which GSWC is based), who translated and reimplemented the algorithms originally written in Matlab by David Jackett, Trevor McDougall, and Paul Barker.
The present Python library has an interface that is similar to the original Matlab code, but with a few important differences:
Many functions in the GSWMatlab toolbox are not yet available here.
Taking advantage of Python namespaces, we omit the “gsw” prefix from the function names.
Missing values may be handled using numpy.ma masked arrays, or using nan values.
All functions follow numpy broadcasting rules; function arguments must be broadcastable to the dimensions of the highestdimensioned argument. Recall that with numpy broadcasting, extra dimensions are automatically added as needed on the left, but must be added explicitly as needed on the right.
Functions such as Nsquared that operate on profiles rather than scalars have an axis keyword argument to specify the index that is incremented along the pressure (depth) axis.

gsw.
CT_first_derivatives
(SA, pt)[source]¶ Calculates the following two derivatives of Conservative Temperature (1) CT_SA, the derivative with respect to Absolute Salinity at constant potential temperature (with pr = 0 dbar), and 2) CT_pt, the derivative with respect to potential temperature (the regular potential temperature which is referenced to 0 dbar) at constant Absolute Salinity.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 ptarraylike
Potential temperature referenced to a sea pressure, degrees C
 Returns
 CT_SAarraylike, K/(g/kg)
The derivative of Conservative Temperature with respect to Absolute Salinity at constant potential temperature (the regular potential temperature which has reference sea pressure of 0 dbar).
 CT_ptarraylike, unitless
The derivative of Conservative Temperature with respect to potential temperature (the regular one with pr = 0 dbar) at constant SA. CT_pt is dimensionless.

gsw.
CT_first_derivatives_wrt_t_exact
(SA, t, p)[source]¶ Calculates the following three derivatives of Conservative Temperature. These derivatives are done with respect to insitu temperature t (in the case of CT_T_wrt_t) or at constant insitu tempertature (in the cases of CT_SA_wrt_t and CT_P_wrt_t). (1) CT_SA_wrt_t, the derivative of CT with respect to Absolute Salinity at constant t and p, and (2) CT_T_wrt_t, derivative of CT with respect to insitu temperature t at constant SA and p. (3) CT_P_wrt_t, derivative of CT with respect to pressure P (in Pa) at constant SA and t.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 CT_SA_wrt_tarraylike, K kg/g
The first derivative of Conservative Temperature with respect to Absolute Salinity at constant t and p. [ K/(g/kg)] i.e.
 CT_T_wrt_tarraylike, unitless
The first derivative of Conservative Temperature with respect to insitu temperature, t, at constant SA and p.
 CT_P_wrt_tarraylike, K/Pa
The first derivative of Conservative Temperature with respect to pressure P (in Pa) at constant SA and t.

gsw.
CT_freezing
(SA, p, saturation_fraction)[source]¶ Calculates the Conservative Temperature at which seawater freezes. The Conservative Temperature freezing point is calculated from the exact insitu freezing temperature which is found by a modified NewtonRaphson iteration (McDougall and Wotherspoon, 2014) of the equality of the chemical potentials of water in seawater and in ice.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 saturation_fractionarraylike
Saturation fraction of dissolved air in seawater. (0..1)
 Returns
 CT_freezingarraylike, deg C
Conservative Temperature at freezing of seawater That is, the freezing temperature expressed in terms of Conservative Temperature (ITS90).

gsw.
CT_freezing_first_derivatives
(SA, p, saturation_fraction)[source]¶ Calculates the first derivatives of the Conservative Temperature at which seawater freezes, with respect to Absolute Salinity SA and pressure P (in Pa).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 saturation_fractionarraylike
Saturation fraction of dissolved air in seawater. (0..1)
 Returns
 CTfreezing_SAarraylike, K kg/g
the derivative of the Conservative Temperature at freezing (ITS90) with respect to Absolute Salinity at fixed pressure [ K/(g/kg) ] i.e.
 CTfreezing_Parraylike, K/Pa
the derivative of the Conservative Temperature at freezing (ITS90) with respect to pressure (in Pa) at fixed Absolute Salinity

gsw.
CT_freezing_first_derivatives_poly
(SA, p, saturation_fraction)[source]¶ Calculates the first derivatives of the Conservative Temperature at which seawater freezes, with respect to Absolute Salinity SA and pressure P (in Pa) of the comptationally efficient polynomial fit of the freezing temperature (McDougall et al., 2014).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 saturation_fractionarraylike
Saturation fraction of dissolved air in seawater. (0..1)
 Returns
 CTfreezing_SAarraylike, K kg/g
the derivative of the Conservative Temperature at freezing (ITS90) with respect to Absolute Salinity at fixed pressure [ K/(g/kg) ] i.e.
 CTfreezing_Parraylike, K/Pa
the derivative of the Conservative Temperature at freezing (ITS90) with respect to pressure (in Pa) at fixed Absolute Salinity

gsw.
CT_freezing_poly
(SA, p, saturation_fraction)[source]¶ Calculates the Conservative Temperature at which seawater freezes. The error of this fit ranges between 5e4 K and 6e4 K when compared with the Conservative Temperature calculated from the exact insitu freezing temperature which is found by a NewtonRaphson iteration of the equality of the chemical potentials of water in seawater and in ice. Note that the Conservative Temperature freezing temperature can be found by this exact method using the function gsw_CT_freezing.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 saturation_fractionarraylike
Saturation fraction of dissolved air in seawater. (0..1)
 Returns
 CT_freezingarraylike, deg C
Conservative Temperature at freezing of seawater That is, the freezing temperature expressed in terms of Conservative Temperature (ITS90).

gsw.
CT_from_enthalpy
(SA, h, p)[source]¶ Calculates the Conservative Temperature of seawater, given the Absolute Salinity, specific enthalpy, h, and pressure p. The specific enthalpy input is the one calculated from the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 harraylike
Specific enthalpy, J/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 CTarraylike, deg C
Conservative Temperature ( ITS90)

gsw.
CT_from_enthalpy_exact
(SA, h, p)[source]¶ Calculates the Conservative Temperature of seawater, given the Absolute Salinity, SA, specific enthalpy, h, and pressure p. The specific enthalpy input is calculated from the full Gibbs function of seawater, gsw_enthalpy_t_exact.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 harraylike
Specific enthalpy, J/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 CTarraylike, deg C
Conservative Temperature ( ITS90)

gsw.
CT_from_entropy
(SA, entropy)[source]¶ Calculates Conservative Temperature with entropy as an input variable.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 entropyarraylike
Specific entropy, J/(kg*K)
 Returns
 CTarraylike, deg C
Conservative Temperature (ITS90)

gsw.
CT_from_pt
(SA, pt)[source]¶ Calculates Conservative Temperature of seawater from potential temperature (whose reference sea pressure is zero dbar).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 ptarraylike
Potential temperature referenced to a sea pressure, degrees C
 Returns
 CTarraylike, deg C
Conservative Temperature (ITS90)

gsw.
CT_from_rho
(rho, SA, p)[source]¶ Calculates the Conservative Temperature of a seawater sample, for given values of its density, Absolute Salinity and sea pressure (in dbar), using the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 rhoarraylike
Seawater density (not anomaly) insitu, e.g., 1026 kg/m^3.
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 CTarraylike, deg C
Conservative Temperature (ITS90)
 CT_multiplearraylike, deg C
Conservative Temperature (ITS90)

gsw.
CT_from_t
(SA, t, p)[source]¶ Calculates Conservative Temperature of seawater from insitu temperature.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 CTarraylike, deg C
Conservative Temperature (ITS90)

gsw.
CT_maxdensity
(SA, p)[source]¶ Calculates the Conservative Temperature of maximum density of seawater. This function returns the Conservative temperature at which the density of seawater is a maximum, at given Absolute Salinity, SA, and sea pressure, p (in dbar). This function uses the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 CT_maxdensityarraylike, deg C
Conservative Temperature at which the density of seawater is a maximum for given Absolute Salinity and pressure.

gsw.
CT_second_derivatives
(SA, pt)[source]¶ Calculates the following three, secondorder derivatives of Conservative Temperature (1) CT_SA_SA, the second derivative with respect to Absolute Salinity at constant potential temperature (with p_ref = 0 dbar), (2) CT_SA_pt, the derivative with respect to potential temperature (the regular potential temperature which is referenced to 0 dbar) and Absolute Salinity, and (3) CT_pt_pt, the second derivative with respect to potential temperature (the regular potential temperature which is referenced to 0 dbar) at constant Absolute Salinity.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 ptarraylike
Potential temperature referenced to a sea pressure, degrees C
 Returns
 CT_SA_SAarraylike, K/((g/kg)^2)
The second derivative of Conservative Temperature with respect to Absolute Salinity at constant potential temperature (the regular potential temperature which has reference sea pressure of 0 dbar).
 CT_SA_ptarraylike,
The derivative of Conservative Temperature with respect to potential temperature (the regular one with
 p_refarraylike, 1/(g/kg)
0 dbar) and Absolute Salinity.
 CT_pt_ptarraylike,
The second derivative of Conservative Temperature with respect to potential temperature (the regular one with
 p_refarraylike, 1/K
0 dbar) at constant SA.

gsw.
C_from_SP
(SP, t, p)[source]¶ Calculates conductivity, C, from (SP,t,p) using PSS78 in the range 2 < SP < 42. If the input Practical Salinity is less than 2 then a modified form of the Hill et al. (1986) fomula is used for Practical Salinity. The modification of the Hill et al. (1986) expression is to ensure that it is exactly consistent with PSS78 at SP = 2.
 Parameters
 SParraylike
Practical Salinity (PSS78), unitless
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 Carraylike, mS/cm
conductivity

gsw.
Fdelta
(p, lon, lat)[source]¶ Calculates Fdelta from the Absolute Salinity Anomaly Ratio (SAAR). It finds SAAR by calling the function “gsw_SAAR(p,long,lat)” and then simply calculates Fdelta from
 Parameters
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 lonarraylike
Longitude, 360 to 360 degrees
 latarraylike
Latitude, 90 to 90 degrees
 Returns
 Fdeltaarraylike, unitless
ratio of SA to Sstar, minus 1

gsw.
Helmholtz_energy_ice
(t, p)[source]¶ Calculates the Helmholtz energy of ice.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 Helmholtz_energy_icearraylike, J/kg
Helmholtz energy of ice

gsw.
Hill_ratio_at_SP2
(t)[source]¶ Calculates the Hill ratio, which is the adjustment needed to apply for Practical Salinities smaller than 2. This ratio is defined at a Practical Salinity = 2 and insitu temperature, t using PSS78. The Hill ratio is the ratio of 2 to the output of the Hill et al. (1986) formula for Practical Salinity at the conductivity ratio, Rt, at which Practical Salinity on the PSS78 scale is exactly 2.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 Returns
 Hill_ratioarraylike, unitless
Hill ratio at SP of 2

gsw.
IPV_vs_fNsquared_ratio
(SA, CT, p, p_ref=0, axis=0)[source]¶ Calculates the ratio of the vertical gradient of potential density to the vertical gradient of locallyreferenced potential density. This is also the ratio of the planetary Isopycnal Potential Vorticity (IPV) to f times N^2, hence the name for this variable, IPV_vs_fNsquared_ratio (see Eqn. (3.20.17) of IOC et al. (2010)).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 p_reffloat
Reference pressure, dbar
 Returns
 IPV_vs_fNsquared_ratioarray
The ratio of the vertical gradient of potential density referenced to p_ref, to the vertical gradient of locallyreferenced potential density, dimensionless.
 p_midarray
Pressure at midpoints of p, dbar. The array shape matches IPV_vs_fNsquared_ratio.

gsw.
Nsquared
(SA, CT, p, lat=None, axis=0)[source]¶ Calculate the square of the buoyancy frequency.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 latarraylike, 1D, optional
Latitude, degrees.
 axisint, optional
The dimension along which pressure increases.
 Returns
 N2array
Buoyancy frequencysquared at pressure midpoints, 1/s. The shape along the pressure axis dimension is one less than that of the inputs.
 p_midarray
Pressure at midpoints of p, dbar. The array shape matches N2.

gsw.
O2sol
(SA, CT, p, lon, lat)[source]¶ Calculates the oxygen concentration expected at equilibrium with air at an Absolute Pressure of 101325 Pa (sea pressure of 0 dbar) including saturated water vapor. This function uses the solubility coefficients derived from the data of Benson and Krause (1984), as fitted by Garcia and Gordon (1992, 1993).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 lonarraylike
Longitude, 360 to 360 degrees
 latarraylike
Latitude, 90 to 90 degrees
 Returns
 O2solarraylike, umol/kg
solubility of oxygen in micromoles per kg

gsw.
O2sol_SP_pt
(SP, pt)[source]¶ Calculates the oxygen concentration expected at equilibrium with air at an Absolute Pressure of 101325 Pa (sea pressure of 0 dbar) including saturated water vapor. This function uses the solubility coefficients derived from the data of Benson and Krause (1984), as fitted by Garcia and Gordon (1992, 1993).
 Parameters
 SParraylike
Practical Salinity (PSS78), unitless
 ptarraylike
Potential temperature referenced to a sea pressure, degrees C
 Returns
 O2solarraylike, umol/kg
solubility of oxygen in micromoles per kg

gsw.
SAAR
(p, lon, lat)[source]¶ Calculates the Absolute Salinity Anomaly Ratio, SAAR, in the open ocean by spatially interpolating the global reference data set of SAAR to the location of the seawater sample.
 Parameters
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 lonarraylike
Longitude, 360 to 360 degrees
 latarraylike
Latitude, 90 to 90 degrees
 Returns
 SAARarraylike, unitless
Absolute Salinity Anomaly Ratio

gsw.
SA_freezing_from_CT
(CT, p, saturation_fraction)[source]¶ Calculates the Absolute Salinity of seawater at the freezing temperature. That is, the output is the Absolute Salinity of seawater, with Conservative Temperature CT, pressure p and the fraction saturation_fraction of dissolved air, that is in equilibrium with ice at the same in situ temperature and pressure. If the input values are such that there is no positive value of Absolute Salinity for which seawater is frozen, the output, SA_freezing, is made a NaN.
 Parameters
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 saturation_fractionarraylike
Saturation fraction of dissolved air in seawater. (0..1)
 Returns
 SA_freezingarraylike, g/kg
Absolute Salinity of seawater when it freezes, for given input values of its Conservative Temperature, pressure and air saturation fraction.

gsw.
SA_freezing_from_CT_poly
(CT, p, saturation_fraction)[source]¶ Calculates the Absolute Salinity of seawater at the freezing temperature. That is, the output is the Absolute Salinity of seawater, with the fraction saturation_fraction of dissolved air, that is in equilibrium with ice at Conservative Temperature CT and pressure p. If the input values are such that there is no positive value of Absolute Salinity for which seawater is frozen, the output, SA_freezing, is put equal to NaN.
 Parameters
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 saturation_fractionarraylike
Saturation fraction of dissolved air in seawater. (0..1)
 Returns
 SA_freezingarraylike, g/kg
Absolute Salinity of seawater when it freezes, for given input values of Conservative Temperature pressure and air saturation fraction.

gsw.
SA_freezing_from_t
(t, p, saturation_fraction)[source]¶ Calculates the Absolute Salinity of seawater at the freezing temperature. That is, the output is the Absolute Salinity of seawater, with the fraction saturation_fraction of dissolved air, that is in equilibrium with ice at insitu temperature t and pressure p. If the input values are such that there is no positive value of Absolute Salinity for which seawater is frozen, the output, SA_freezing, is set to NaN.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 saturation_fractionarraylike
Saturation fraction of dissolved air in seawater. (0..1)
 Returns
 SA_freezingarraylike, g/kg
Absolute Salinity of seawater when it freezes, for given input values of in situ temperature, pressure and air saturation fraction.

gsw.
SA_freezing_from_t_poly
(t, p, saturation_fraction)[source]¶ Calculates the Absolute Salinity of seawater at the freezing temperature. That is, the output is the Absolute Salinity of seawater, with the fraction saturation_fraction of dissolved air, that is in equilibrium with ice at insitu temperature t and pressure p. If the input values are such that there is no positive value of Absolute Salinity for which seawater is frozen, the output, SA_freezing, is put equal to NaN.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 saturation_fractionarraylike
Saturation fraction of dissolved air in seawater. (0..1)
 Returns
 SA_freezingarraylike, g/kg
Absolute Salinity of seawater when it freezes, for given input values of in situ temperature, pressure and air saturation fraction.

gsw.
SA_from_SP
(SP, p, lon, lat)[source]¶ Calculates Absolute Salinity from Practical Salinity. Since SP is nonnegative by definition, this function changes any negative input values of SP to be zero.
 Parameters
 SParraylike
Practical Salinity (PSS78), unitless
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 lonarraylike
Longitude, 360 to 360 degrees
 latarraylike
Latitude, 90 to 90 degrees
 Returns
 SAarraylike, g/kg
Absolute Salinity

gsw.
SA_from_SP_Baltic
(SP, lon, lat)[source]¶ Calculates Absolute Salinity in the Baltic Sea, from Practical Salinity. Since SP is nonnegative by definition, this function changes any negative input values of SP to be zero. Note. This programme will only produce Absolute Salinity values for the Baltic Sea.
 Parameters
 SParraylike
Practical Salinity (PSS78), unitless
 lonarraylike
Longitude, 360 to 360 degrees
 latarraylike
Latitude, 90 to 90 degrees
 Returns
 SA_balticarraylike, g kg^1
Absolute Salinity in the Baltic Sea

gsw.
SA_from_Sstar
(Sstar, p, lon, lat)[source]¶ Calculates Absolute Salinity from Preformed Salinity.
 Parameters
 Sstararraylike
Preformed Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 lonarraylike
Longitude, 360 to 360 degrees
 latarraylike
Latitude, 90 to 90 degrees
 Returns
 SAarraylike, g/kg
Absolute Salinity

gsw.
SA_from_rho
(rho, CT, p)[source]¶ Calculates the Absolute Salinity of a seawater sample, for given values of its density, Conservative Temperature and sea pressure (in dbar). This function uses the computationallyefficient 75term expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 rhoarraylike
Seawater density (not anomaly) insitu, e.g., 1026 kg/m^3.
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 SAarraylike, g/kg
Absolute Salinity.

gsw.
SP_from_C
(C, t, p)[source]¶ Calculates Practical Salinity, SP, from conductivity, C, primarily using the PSS78 algorithm. Note that the PSS78 algorithm for Practical Salinity is only valid in the range 2 < SP < 42. If the PSS78 algorithm produces a Practical Salinity that is less than 2 then the Practical Salinity is recalculated with a modified form of the Hill et al. (1986) formula. The modification of the Hill et al. (1986) expression is to ensure that it is exactly consistent with PSS78 at SP = 2. Note that the input values of conductivity need to be in units of mS/cm (not S/m).
 Parameters
 Carraylike
Conductivity, mS/cm
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 SParraylike, unitless
Practical Salinity on the PSS78 scale

gsw.
SP_from_SA
(SA, p, lon, lat)[source]¶ Calculates Practical Salinity from Absolute Salinity.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 lonarraylike
Longitude, 360 to 360 degrees
 latarraylike
Latitude, 90 to 90 degrees
 Returns
 SParraylike, unitless
Practical Salinity (PSS78)

gsw.
SP_from_SA_Baltic
(SA, lon, lat)[source]¶ Calculates Practical Salinity for the Baltic Sea, from a value computed analytically from Absolute Salinity. Note. This programme will only produce Practical Salinty values for the Baltic Sea.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 lonarraylike
Longitude, 360 to 360 degrees
 latarraylike
Latitude, 90 to 90 degrees
 Returns
 SP_balticarraylike, unitless
Practical Salinity

gsw.
SP_from_SK
(SK)[source]¶ Calculates Practical Salinity from Knudsen Salinity.
 Parameters
 SKarraylike
Knudsen Salinity, ppt
 Returns
 SParraylike, unitless
Practical Salinity (PSS78)

gsw.
SP_from_SR
(SR)[source]¶ Calculates Practical Salinity from Reference Salinity.
 Parameters
 SRarraylike
Reference Salinity, g/kg
 Returns
 SParraylike, unitless
Practical Salinity (PSS78)

gsw.
SP_from_Sstar
(Sstar, p, lon, lat)[source]¶ Calculates Practical Salinity from Preformed Salinity.
 Parameters
 Sstararraylike
Preformed Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 lonarraylike
Longitude, 360 to 360 degrees
 latarraylike
Latitude, 90 to 90 degrees
 Returns
 SParraylike, unitless
Practical Salinity (PSS78)

gsw.
SP_salinometer
(Rt, t)[source]¶ Calculates Practical Salinity SP from a salinometer, primarily using the PSS78 algorithm. Note that the PSS78 algorithm for Practical Salinity is only valid in the range 2 < SP < 42. If the PSS78 algorithm produces a Practical Salinity that is less than 2 then the Practical Salinity is recalculated with a modified form of the Hill et al. (1986) formula. The modification of the Hill et al. (1986) expression is to ensure that it is exactly consistent with PSS78 at SP = 2.
 Parameters
 Rtarraylike
C(SP,t_68,0)/C(SP=35,t_68,0), unitless
 tarraylike
Insitu temperature (ITS90), degrees C
 Returns
 SParraylike, unitless
Practical Salinity on the PSS78 scale t may have dimensions 1x1 or Mx1 or 1xN or MxN, where Rt is MxN.

gsw.
SR_from_SP
(SP)[source]¶ Calculates Reference Salinity from Practical Salinity.
 Parameters
 SParraylike
Practical Salinity (PSS78), unitless
 Returns
 SRarraylike, g/kg
Reference Salinity

gsw.
Sstar_from_SA
(SA, p, lon, lat)[source]¶ Converts Preformed Salinity from Absolute Salinity.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 lonarraylike
Longitude, 360 to 360 degrees
 latarraylike
Latitude, 90 to 90 degrees
 Returns
 Sstararraylike, g/kg
Preformed Salinity

gsw.
Sstar_from_SP
(SP, p, lon, lat)[source]¶ Calculates Preformed Salinity from Absolute Salinity. Since SP is nonnegative by definition, this function changes any negative input values of SP to be zero.
 Parameters
 SParraylike
Practical Salinity (PSS78), unitless
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 lonarraylike
Longitude, 360 to 360 degrees
 latarraylike
Latitude, 90 to 90 degrees
 Returns
 Sstararraylike, g/kg
Preformed Salinity

gsw.
Turner_Rsubrho
(SA, CT, p, axis=0)[source]¶ Calculate the Turner Angle and the Stability Ratio.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 axisint, optional
The dimension along which pressure increases.
 Returns
 Tuarray
Turner Angle at pressure midpoints, degrees. The shape along the pressure axis dimension is one less than that of the inputs.
 Rsubrhoarray
Stability Ratio, dimensionless. The shape matches Tu.
 p_midarray
Pressure at midpoints of p, dbar. The array shape matches Tu.

gsw.
adiabatic_lapse_rate_from_CT
(SA, CT, p)[source]¶ Calculates the adiabatic lapse rate of sea water from Conservative Temperature.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 adiabatic_lapse_ratearraylike, K/Pa
adiabatic lapse rate

gsw.
adiabatic_lapse_rate_ice
(t, p)[source]¶ Calculates the adiabatic lapse rate of ice.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 adiabatic_lapse_rate_icearraylike, K/Pa
adiabatic lapse rate

gsw.
alpha
(SA, CT, p)[source]¶ Calculates the thermal expansion coefficient of seawater with respect to Conservative Temperature using the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 alphaarraylike, 1/K
thermal expansion coefficient with respect to Conservative Temperature

gsw.
alpha_on_beta
(SA, CT, p)[source]¶ Calculates alpha divided by beta, where alpha is the thermal expansion coefficient and beta is the saline contraction coefficient of seawater from Absolute Salinity and Conservative Temperature. This function uses the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 alpha_on_betaarraylike, kg g^1 K^1
thermal expansion coefficient with respect to Conservative Temperature divided by the saline contraction coefficient at constant Conservative Temperature

gsw.
alpha_wrt_t_exact
(SA, t, p)[source]¶ Calculates the thermal expansion coefficient of seawater with respect to insitu temperature.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 alpha_wrt_t_exactarraylike, 1/K
thermal expansion coefficient with respect to insitu temperature

gsw.
alpha_wrt_t_ice
(t, p)[source]¶ Calculates the thermal expansion coefficient of ice with respect to insitu temperature.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 alpha_wrt_t_icearraylike, 1/K
thermal expansion coefficient of ice with respect to insitu temperature

gsw.
beta
(SA, CT, p)[source]¶ Calculates the saline (i.e. haline) contraction coefficient of seawater at constant Conservative Temperature using the computationallyefficient 75term expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 betaarraylike, kg/g
saline contraction coefficient at constant Conservative Temperature

gsw.
beta_const_t_exact
(SA, t, p)[source]¶ Calculates the saline (i.e. haline) contraction coefficient of seawater at constant insitu temperature.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 beta_const_t_exactarraylike, kg/g
saline contraction coefficient at constant insitu temperature

gsw.
cabbeling
(SA, CT, p)[source]¶ Calculates the cabbeling coefficient of seawater with respect to Conservative Temperature. This function uses the computationally efficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 cabbelingarraylike, 1/K^2
cabbeling coefficient with respect to Conservative Temperature.

gsw.
chem_potential_water_ice
(t, p)[source]¶ Calculates the chemical potential of water in ice from insitu temperature and pressure.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 chem_potential_water_icearraylike, J/kg
chemical potential of ice

gsw.
chem_potential_water_t_exact
(SA, t, p)[source]¶ Calculates the chemical potential of water in seawater.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 chem_potential_water_t_exactarraylike, J/g
chemical potential of water in seawater

gsw.
cp_ice
(t, p)[source]¶ Calculates the isobaric heat capacity of seawater.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 cp_icearraylike, J kg^1 K^1
heat capacity of ice

gsw.
cp_t_exact
(SA, t, p)[source]¶ Calculates the isobaric heat capacity of seawater.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 cp_t_exactarraylike, J/(kg*K)
heat capacity of seawater

gsw.
deltaSA_atlas
(p, lon, lat)[source]¶ Calculates the Absolute Salinity Anomaly atlas value, SA  SR, in the open ocean by spatially interpolating the global reference data set of deltaSA_atlas to the location of the seawater sample.
 Parameters
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 lonarraylike
Longitude, 360 to 360 degrees
 latarraylike
Latitude, 90 to 90 degrees
 Returns
 deltaSA_atlasarraylike, g/kg
Absolute Salinity Anomaly atlas value

gsw.
deltaSA_from_SP
(SP, p, lon, lat)[source]¶ Calculates Absolute Salinity Anomaly from Practical Salinity. Since SP is nonnegative by definition, this function changes any negative input values of SP to be zero.
 Parameters
 SParraylike
Practical Salinity (PSS78), unitless
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 lonarraylike
Longitude, 360 to 360 degrees
 latarraylike
Latitude, 90 to 90 degrees
 Returns
 deltaSAarraylike, g/kg
Absolute Salinity Anomaly

gsw.
dilution_coefficient_t_exact
(SA, t, p)[source]¶ Calculates the dilution coefficient of seawater. The dilution coefficient of seawater is defined as the Absolute Salinity times the second derivative of the Gibbs function with respect to Absolute Salinity, that is, SA.*g_SA_SA.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 dilution_coefficient_t_exactarraylike, (J/kg)(kg/g)
dilution coefficient

gsw.
distance
(lon, lat, p=0, axis=1)[source]¶ Greatcircle distance in m between lon, lat points.
 Parameters
 lon, latarraylike, 1D or 2D (shapes must match)
Longitude, latitude, in degrees.
 parraylike, scalar, 1D or 2D, optional, default is 0
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 axisint, 1, 0, 1, optional
The axis or dimension along which lat and lon vary. This differs from most functions, for which axis is the dimension along which p increases.
 Returns
 distance1D or 2D array
distance in meters between adjacent points.

gsw.
dynamic_enthalpy
(SA, CT, p)[source]¶ Calculates dynamic enthalpy of seawater using the computationally efficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015). Dynamic enthalpy is defined as enthalpy minus potential enthalpy (Young, 2010).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 dynamic_enthalpyarraylike, J/kg
dynamic enthalpy

gsw.
enthalpy
(SA, CT, p)[source]¶ Calculates specific enthalpy of seawater using the computationally efficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 enthalpyarraylike, J/kg
specific enthalpy

gsw.
enthalpy_CT_exact
(SA, CT, p)[source]¶ Calculates specific enthalpy of seawater from Absolute Salinity and Conservative Temperature and pressure.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 enthalpy_CT_exactarraylike, J/kg
specific enthalpy

gsw.
enthalpy_diff
(SA, CT, p_shallow, p_deep)[source]¶ Calculates the difference of the specific enthalpy of seawater between two different pressures, p_deep (the deeper pressure) and p_shallow (the shallower pressure), at the same values of SA and CT. This function uses the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015). The output (enthalpy_diff) is the specific enthalpy evaluated at (SA,CT,p_deep) minus the specific enthalpy at (SA,CT,p_shallow).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 p_shallowarraylike
Upper sea pressure (absolute pressure minus 10.1325 dbar), dbar
 p_deeparraylike
Lower sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 enthalpy_diffarraylike, J/kg
difference of specific enthalpy (deep minus shallow)

gsw.
enthalpy_first_derivatives
(SA, CT, p)[source]¶ Calculates the following two derivatives of specific enthalpy (h) of seawater using the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015). (1) h_SA, the derivative with respect to Absolute Salinity at constant CT and p, and (2) h_CT, derivative with respect to CT at constant SA and p. Note that h_P is specific volume (1/rho) it can be caclulated by calling gsw_specvol(SA,CT,p).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 h_SAarraylike, J/g
The first derivative of specific enthalpy with respect to Absolute Salinity at constant CT and p. [ J/(kg (g/kg))] i.e.
 h_CTarraylike, J/(kg K)
The first derivative of specific enthalpy with respect to CT at constant SA and p.

gsw.
enthalpy_first_derivatives_CT_exact
(SA, CT, p)[source]¶ Calculates the following two derivatives of specific enthalpy, h, (1) h_SA, the derivative with respect to Absolute Salinity at constant CT and p, and (2) h_CT, derivative with respect to CT at constant SA and p. Note that h_P is specific volume, v, it can be calulated by calling gsw_specvol_CT_exact(SA,CT,p).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 h_SAarraylike, J/g
The first derivative of specific enthalpy with respect to Absolute Salinity at constant CT and p. [ J/(kg (g/kg))] i.e.
 h_CTarraylike, J/(kg K)
The first derivative of specific enthalpy with respect to CT at constant SA and p.

gsw.
enthalpy_ice
(t, p)[source]¶ Calculates the specific enthalpy of ice (h_Ih).
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 enthalpy_icearraylike, J/kg
specific enthalpy of ice

gsw.
enthalpy_second_derivatives
(SA, CT, p)[source]¶ Calculates the following three secondorder derivatives of specific enthalpy (h),using the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015). (1) h_SA_SA, secondorder derivative with respect to Absolute Salinity at constant CT & p. (2) h_SA_CT, secondorder derivative with respect to SA & CT at constant p. (3) h_CT_CT, secondorder derivative with respect to CT at constant SA and p.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 h_SA_SAarraylike, J/(kg (g/kg)^2)
The second derivative of specific enthalpy with respect to Absolute Salinity at constant CT & p.
 h_SA_CTarraylike, J/(kg K(g/kg))
The second derivative of specific enthalpy with respect to SA and CT at constant p.
 h_CT_CTarraylike, J/(kg K^2)
The second derivative of specific enthalpy with respect to CT at constant SA and p.

gsw.
enthalpy_second_derivatives_CT_exact
(SA, CT, p)[source]¶ Calculates the following three secondorder derivatives of specific enthalpy (h), (1) h_SA_SA, secondorder derivative with respect to Absolute Salinity at constant CT & p. (2) h_SA_CT, secondorder derivative with respect to SA & CT at constant p. (3) h_CT_CT, secondorder derivative with respect to CT at constant SA and p.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 h_SA_SAarraylike, J/(kg (g/kg)^2)
The second derivative of specific enthalpy with respect to Absolute Salinity at constant CT & p.
 h_SA_CTarraylike, J/(kg K(g/kg))
The second derivative of specific enthalpy with respect to SA and CT at constant p.
 h_CT_CTarraylike, J/(kg K^2)
The second derivative of specific enthalpy with respect to CT at constant SA and p.

gsw.
enthalpy_t_exact
(SA, t, p)[source]¶ Calculates the specific enthalpy of seawater.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 enthalpy_t_exactarraylike, J/kg
specific enthalpy

gsw.
entropy_first_derivatives
(SA, CT)[source]¶ Calculates the following two partial derivatives of specific entropy (eta) (1) eta_SA, the derivative with respect to Absolute Salinity at constant Conservative Temperature, and (2) eta_CT, the derivative with respect to Conservative Temperature at constant Absolute Salinity.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 Returns
 eta_SAarraylike, J/(g K)
The derivative of specific entropy with respect to Absolute Salinity (in units of g kg^1) at constant Conservative Temperature.
 eta_CTarraylike, J/(kg K^2)
The derivative of specific entropy with respect to Conservative Temperature at constant Absolute Salinity.

gsw.
entropy_from_CT
(SA, CT)[source]¶ Calculates specific entropy of seawater from Conservative Temperature.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 Returns
 entropyarraylike, J/(kg*K)
specific entropy

gsw.
entropy_from_pt
(SA, pt)[source]¶ Calculates specific entropy of seawater as a function of potential temperature.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 ptarraylike
Potential temperature referenced to a sea pressure, degrees C
 Returns
 entropyarraylike, J/(kg*K)
specific entropy

gsw.
entropy_from_t
(SA, t, p)[source]¶ Calculates specific entropy of seawater from insitu temperature.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 entropyarraylike, J/(kg*K)
specific entropy

gsw.
entropy_ice
(t, p)[source]¶ Calculates specific entropy of ice.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 ice_entropyarraylike, J kg^1 K^1
specific entropy of ice

gsw.
entropy_second_derivatives
(SA, CT)[source]¶ Calculates the following three secondorder partial derivatives of specific entropy (eta) (1) eta_SA_SA, the second derivative with respect to Absolute Salinity at constant Conservative Temperature, and (2) eta_SA_CT, the derivative with respect to Absolute Salinity and Conservative Temperature. (3) eta_CT_CT, the second derivative with respect to Conservative Temperature at constant Absolute Salinity.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 Returns
 eta_SA_SAarraylike, J/(kg K(g/kg)^2)
The second derivative of specific entropy with respect to Absolute Salinity (in units of g kg^1) at constant Conservative Temperature.
 eta_SA_CTarraylike, J/(kg (g/kg) K^2)
The second derivative of specific entropy with respect to Conservative Temperature at constant Absolute
 eta_CT_CTarraylike, J/(kg K^3)
The second derivative of specific entropy with respect to Conservative Temperature at constant Absolute

gsw.
frazil_properties
(SA_bulk, h_bulk, p)[source]¶ Calculates the mass fraction of ice (mass of ice divided by mass of ice plus seawater), w_Ih_final, which results from given values of the bulk Absolute Salinity, SA_bulk, bulk enthalpy, h_bulk, occuring at pressure p. The final values of Absolute Salinity, SA_final, and Conservative Temperature, CT_final, of the interstitial seawater phase are also returned. This code assumes that there is no dissolved air in the seawater (that is, saturation_fraction is assumed to be zero throughout the code).
 Parameters
 SA_bulkarraylike
bulk Absolute Salinity of the seawater and ice mixture, g/kg
 h_bulkarraylike
bulk enthalpy of the seawater and ice mixture, J/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 SA_finalarraylike, g/kg
Absolute Salinity of the seawater in the final state, whether or not any ice is present.
 CT_finalarraylike, deg C
Conservative Temperature of the seawater in the the final state, whether or not any ice is present.
 w_Ih_finalarraylike, unitless
mass fraction of ice in the final seawaterice mixture. If this ice mass fraction is positive, the system is at thermodynamic equilibrium. If this ice mass fraction is zero there is no ice in the final state which consists only of seawater which is warmer than the freezing temperature.

gsw.
frazil_properties_potential
(SA_bulk, h_pot_bulk, p)[source]¶ Calculates the mass fraction of ice (mass of ice divided by mass of ice plus seawater), w_Ih_eq, which results from given values of the bulk Absolute Salinity, SA_bulk, bulk potential enthalpy, h_pot_bulk, occuring at pressure p. The final equilibrium values of Absolute Salinity, SA_eq, and Conservative Temperature, CT_eq, of the interstitial seawater phase are also returned. This code assumes that there is no dissolved air in the seawater (that is, saturation_fraction is assumed to be zero thoughout the code).
 Parameters
 SA_bulkarraylike
bulk Absolute Salinity of the seawater and ice mixture, g/kg
 h_pot_bulkarraylike
bulk enthalpy of the seawater and ice mixture, J/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 SA_finalarraylike, g/kg
Absolute Salinity of the seawater in the final state, whether or not any ice is present.
 CT_finalarraylike, deg C
Conservative Temperature of the seawater in the the final state, whether or not any ice is present.
 w_Ih_finalarraylike, unitless
mass fraction of ice in the final seawaterice mixture. If this ice mass fraction is positive, the system is at thermodynamic equilibrium. If this ice mass fraction is zero there is no ice in the final state which consists only of seawater which is warmer than the freezing temperature.

gsw.
frazil_properties_potential_poly
(SA_bulk, h_pot_bulk, p)[source]¶ Calculates the mass fraction of ice (mass of ice divided by mass of ice plus seawater), w_Ih_eq, which results from given values of the bulk Absolute Salinity, SA_bulk, bulk potential enthalpy, h_pot_bulk, occuring at pressure p. The final equilibrium values of Absolute Salinity, SA_eq, and Conservative Temperature, CT_eq, of the interstitial seawater phase are also returned. This code assumes that there is no dissolved air in the seawater (that is, saturation_fraction is assumed to be zero thoughout the code).
 Parameters
 SA_bulkarraylike
bulk Absolute Salinity of the seawater and ice mixture, g/kg
 h_pot_bulkarraylike
bulk enthalpy of the seawater and ice mixture, J/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 SA_finalarraylike, g/kg
Absolute Salinity of the seawater in the final state, whether or not any ice is present.
 CT_finalarraylike, deg C
Conservative Temperature of the seawater in the the final state, whether or not any ice is present.
 w_Ih_finalarraylike, unitless
mass fraction of ice in the final seawaterice mixture. If this ice mass fraction is positive, the system is at thermodynamic equilibrium. If this ice mass fraction is zero there is no ice in the final state which consists only of seawater which is warmer than the freezing temperature.

gsw.
frazil_ratios_adiabatic
(SA, p, w_Ih)[source]¶ Calculates the ratios of SA, CT and P changes when frazil ice forms or melts in response to an adiabatic change in pressure of a mixture of seawater and frazil ice crystals.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 w_Iharraylike
mass fraction of ice: the mass of ice divided by the sum of the masses of ice and seawater. 0 <= wIh <= 1. unitless.
 Returns
 dSA_dCT_frazilarraylike, g/(kg K)
the ratio of the changes in Absolute Salinity to that of Conservative Temperature
 dSA_dP_frazilarraylike, g/(kg Pa)
the ratio of the changes in Absolute Salinity to that of pressure (in Pa)
 dCT_dP_frazilarraylike, K/Pa
the ratio of the changes in Conservative Temperature to that of pressure (in Pa)

gsw.
frazil_ratios_adiabatic_poly
(SA, p, w_Ih)[source]¶ Calculates the ratios of SA, CT and P changes when frazil ice forms or melts in response to an adiabatic change in pressure of a mixture of seawater and frazil ice crystals.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 w_Iharraylike
mass fraction of ice: the mass of ice divided by the sum of the masses of ice and seawater. 0 <= wIh <= 1. unitless.
 Returns
 dSA_dCT_frazilarraylike, g/(kg K)
the ratio of the changes in Absolute Salinity to that of Conservative Temperature
 dSA_dP_frazilarraylike, g/(kg Pa)
the ratio of the changes in Absolute Salinity to that of pressure (in Pa)
 dCT_dP_frazilarraylike, K/Pa
the ratio of the changes in Conservative Temperature to that of pressure (in Pa)

gsw.
geo_strf_dyn_height
(SA, CT, p, p_ref=0, axis=0, max_dp=1.0, interp_method='pchip')[source]¶ Dynamic height anomaly as a function of pressure.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 p_reffloat or arraylike, optional
Reference pressure, dbar
 axisint, optional, default is 0
The index of the pressure dimension in SA and CT.
 max_dpfloat
If any pressure interval in the input p exceeds max_dp, the dynamic height will be calculated after interpolating to a grid with this spacing.
 interp_methodstring {‘pchip’, ‘linear’}
Interpolation algorithm.
 Returns
 dynamic_heightarray
This is the integral of specific volume anomaly with respect to pressure, from each pressure in p to the specified reference pressure. It is the geostrophic streamfunction in an isobaric surface, relative to the reference surface.

gsw.
geostrophic_velocity
(geo_strf, lon, lat, p=0, axis=0)[source]¶ Calculate geostrophic velocity from a streamfunction.
Calculates geostrophic velocity relative to a reference pressure, given a geostrophic streamfunction and the position of each station in sequence along an ocean section. The data can be from a single isobaric or “density” surface, or from a series of such surfaces.
 Parameters
 geo_strfarraylike, 1D or 2D
geostrophic streamfunction; see Notes below.
 lonarraylike, 1D
Longitude, 360 to 360 degrees
 latarraylike, 1D
Latitude, degrees
 pfloat or arraylike, optional
Sea pressure (absolute pressure minus 10.1325 dbar), dbar. This used only for a tiny correction in the distance calculation; it is safe to omit it.
 axisint, 0 or 1, optional
The axis or dimension along which pressure increases in geo_strf. If geo_strf is 1D, it is ignored.
 Returns
 velocityarray, 2D or 1D
Geostrophic velocity in m/s relative to the sea surface, averaged between each successive pair of positions.
 mid_lon, mid_latarray, 1D
Midpoints of input lon and lat.
Notes
The geostrophic streamfunction can be:
geo_strf_dyn_height (in an isobaric surface)
geo_strf_Montgomery (in a specific volume anomaly surface)
geo_strf_Cunninhgam (in an approximately neutral surface such as a potential density surface).
geo_strf_isopycnal (in an approximately neutral surface such as a potential density surface, a Neutral Density surface, or an omega surface (Klocker et al., 2009)).
Only
geo_strf_dyn_height()
is presently implemented in GSWPython.

gsw.
gibbs_ice_part_t
(t, p)[source]¶ part of the the first temperature derivative of Gibbs energy of ice that is the outout is gibbs_ice(1,0,t,p) + S0
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 gibbs_ice_part_tarraylike, J kg^1 K^1
part of temperature derivative

gsw.
gibbs_ice_pt0
(pt0)[source]¶ part of the the first temperature derivative of Gibbs energy of ice that is the outout is “gibbs_ice(1,0,pt0,0) + s0”
 Parameters
 pt0arraylike
Potential temperature with reference pressure of 0 dbar, degrees C
 Returns
 gibbs_ice_part_pt0arraylike, J kg^1 K^1
part of temperature derivative

gsw.
gibbs_ice_pt0_pt0
(pt0)[source]¶ The second temperature derivative of Gibbs energy of ice at the potential temperature with reference sea pressure of zero dbar. That is the output is gibbs_ice(2,0,pt0,0).
 Parameters
 pt0arraylike
Potential temperature with reference pressure of 0 dbar, degrees C
 Returns
 gibbs_ice_pt0_pt0arraylike, J kg^1 K^2
temperature second derivative at pt0

gsw.
grav
(lat, p)[source]¶ Calculates acceleration due to gravity as a function of latitude and as a function of pressure in the ocean.
 Parameters
 latarraylike
Latitude, 90 to 90 degrees
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 gravarraylike, m s^2
gravitational acceleration

gsw.
ice_fraction_to_freeze_seawater
(SA, CT, p, t_Ih)[source]¶ Calculates the mass fraction of ice (mass of ice divided by mass of ice plus seawater), which, when melted into seawater having (SA,CT,p) causes the final dilute seawater to be at the freezing temperature. The other outputs are the Absolute Salinity and Conservative Temperature of the final diluted seawater.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 t_Iharraylike
Insitu temperature of ice (ITS90), degrees C
 Returns
 SA_freezearraylike, g/kg
Absolute Salinity of seawater after the mass fraction of ice, ice_fraction, at temperature t_Ih has melted into the original seawater, and the final mixture is at the freezing temperature of seawater.
 CT_freezearraylike, deg C
Conservative Temperature of seawater after the mass fraction, w_Ih, of ice at temperature t_Ih has melted into the original seawater, and the final mixture is at the freezing temperature of seawater.
 w_Iharraylike, unitless
mass fraction of ice, having insitu temperature t_Ih, which, when melted into seawater at (SA,CT,p) leads to the final diluted seawater being at the freezing temperature. This output must be between 0 and 1.

gsw.
indexer
(shape, axis, order='C')[source]¶ Generator of indexing tuples for “apply_along_axis” usage.
The generator cycles through all axes other than axis. The numpy np.apply_along_axis function only works with functions of a single array; this generator allows us work with a function of more than one array.

gsw.
internal_energy
(SA, CT, p)[source]¶ Calculates specific internal energy of seawater using the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 internal_energyarraylike, J/kg
specific internal energy

gsw.
internal_energy_ice
(t, p)[source]¶ Calculates the specific internal energy of ice.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 internal_energy_icearraylike, J/kg
specific internal energy (u)

gsw.
kappa
(SA, CT, p)[source]¶ Calculates the isentropic compressibility of seawater. This function has inputs of Absolute Salinity and Conservative Temperature. This function uses the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 kappaarraylike, 1/Pa
isentropic compressibility of seawater

gsw.
kappa_const_t_ice
(t, p)[source]¶ Calculates isothermal compressibility of ice. Note. This is the compressibility of ice AT CONSTANT INSITU TEMPERATURE
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 kappa_const_t_icearraylike, 1/Pa
isothermal compressibility

gsw.
kappa_ice
(t, p)[source]¶ Calculates the isentropic compressibility of ice.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 kappa_icearraylike, 1/Pa
isentropic compressibility

gsw.
kappa_t_exact
(SA, t, p)[source]¶ Calculates the isentropic compressibility of seawater.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 kappa_t_exactarraylike, 1/Pa
isentropic compressibility

gsw.
latentheat_evap_CT
(SA, CT)[source]¶ Calculates latent heat, or enthalpy, of evaporation at p = 0 (the surface). It is defined as a function of Absolute Salinity, SA, and Conservative Temperature, CT, and is valid in the ranges 0 < SA < 42 g/kg and 0 < CT < 40 deg C. The errors range between 0.4 and 0.6 J/kg.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 Returns
 latentheat_evaparraylike, J/kg
latent heat of evaporation

gsw.
latentheat_evap_t
(SA, t)[source]¶ Calculates latent heat, or enthalpy, of evaporation at p = 0 (the surface). It is defined as a function of Absolute Salinity, SA, and insitu temperature, t, and is valid in the ranges 0 < SA < 40 g/kg and 0 < CT < 42 deg C. The errors range between 0.4 and 0.6 J/kg.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 Returns
 latentheat_evaparraylike, J/kg
latent heat of evaporation

gsw.
latentheat_melting
(SA, p)[source]¶ Calculates latent heat, or enthalpy, of melting. It is defined in terms of Absolute Salinity, SA, and sea pressure, p, and is valid in the ranges 0 < SA < 42 g kg^1 and 0 < p < 10,000 dbar. This is based on the IAPWS Releases IAPWS09 (for pure water), IAPWS08 (for the saline compoonent of seawater and IAPWS06 for ice Ih.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 latentheat_meltingarraylike, J/kg
latent heat of melting

gsw.
melting_ice_SA_CT_ratio
(SA, CT, p, t_Ih)[source]¶ Calculates the ratio of SA to CT changes when ice melts into seawater. It is assumed that a small mass of ice melts into an infinite mass of seawater. Because of the infinite mass of seawater, the ice will always melt.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 t_Iharraylike
Insitu temperature of ice (ITS90), degrees C
 Returns
 melting_ice_SA_CT_ratioarraylike, g kg^1 K^1
the ratio of SA to CT changes when ice melts into a large mass of seawater

gsw.
melting_ice_SA_CT_ratio_poly
(SA, CT, p, t_Ih)[source]¶ Calculates the ratio of SA to CT changes when ice melts into seawater. It is assumed that a small mass of ice melts into an infinite mass of seawater. Because of the infinite mass of seawater, the ice will always melt.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 t_Iharraylike
Insitu temperature of ice (ITS90), degrees C
 Returns
 melting_ice_SA_CT_ratioarraylike, g kg^1 K^1
the ratio of SA to CT changes when ice melts into a large mass of seawater

gsw.
melting_ice_equilibrium_SA_CT_ratio
(SA, p)[source]¶ Calculates the ratio of SA to CT changes when ice melts into seawater with both the seawater and the seaice temperatures being almost equal to the equilibrium freezing temperature. It is assumed that a small mass of ice melts into an infinite mass of seawater. If indeed the temperature of the seawater and the ice were both equal to the freezing temperature, then no melting or freezing would occur; an imbalance between these three temperatures is needed for freezing or melting to occur (the three temperatures being (1) the seawater temperature, (2) the ice temperature, and (3) the freezing temperature.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 melting_ice_equilibrium_SA_CT_ratioarraylike, g/(kg K)
the ratio dSA/dCT of SA to CT changes when ice melts into seawater, with the seawater and seaice being close to the freezing temperature.

gsw.
melting_ice_equilibrium_SA_CT_ratio_poly
(SA, p)[source]¶ Calculates the ratio of SA to CT changes when ice melts into seawater with both the seawater and the seaice temperatures being almost equal to the equilibrium freezing temperature. It is assumed that a small mass of ice melts into an infinite mass of seawater. If indeed the temperature of the seawater and the ice were both equal to the freezing temperature, then no melting or freezing would occur; an imbalance between these three temperatures is needed for freezing or melting to occur (the three temperatures being (1) the seawater temperature, (2) the ice temperature, and (3) the freezing temperature.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 melting_ice_equilibrium_SA_CT_ratioarraylike, g/(kg K)
the ratio dSA/dCT of SA to CT changes when ice melts into seawater, with the seawater and seaice being close to the freezing temperature.

gsw.
melting_ice_into_seawater
(SA, CT, p, w_Ih, t_Ih)[source]¶ Calculates the final Absolute Salinity, final Conservative Temperature and final ice mass fraction that results when a given mass fraction of ice melts and is mixed into seawater whose properties are (SA,CT,p). This code takes the seawater to contain no dissolved air.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 w_Iharraylike
mass fraction of ice: the mass of ice divided by the sum of the masses of ice and seawater. 0 <= wIh <= 1. unitless.
 t_Iharraylike
Insitu temperature of ice (ITS90), degrees C
 Returns
 SA_finalarraylike, g/kg
Absolute Salinity of the seawater in the final state, whether or not any ice is present.
 CT_finalarraylike, deg C
Conservative Temperature of the seawater in the the final state, whether or not any ice is present.
 w_Ih_finalarraylike, unitless
mass fraction of ice in the final seawaterice mixture. If this ice mass fraction is positive, the system is at thermodynamic equilibrium. If this ice mass fraction is zero there is no ice in the final state which consists only of seawater which is warmer than the freezing temperature.

gsw.
melting_seaice_SA_CT_ratio
(SA, CT, p, SA_seaice, t_seaice)[source]¶ Calculates the ratio of SA to CT changes when sea ice melts into seawater. It is assumed that a small mass of sea ice melts into an infinite mass of seawater. Because of the infinite mass of seawater, the sea ice will always melt.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 SA_seaicearraylike
Absolute Salinity of sea ice: the mass fraction of salt in sea ice, expressed in g of salt per kg of sea ice.
 t_seaicearraylike
Insitu temperature of the sea ice at pressure p (ITS90), degrees C
 Returns
 melting_seaice_SA_CT_ratioarraylike, g/(kg K)
the ratio dSA/dCT of SA to CT changes when sea ice melts into a large mass of seawater

gsw.
melting_seaice_SA_CT_ratio_poly
(SA, CT, p, SA_seaice, t_seaice)[source]¶ Calculates the ratio of SA to CT changes when sea ice melts into seawater. It is assumed that a small mass of sea ice melts into an infinite mass of seawater. Because of the infinite mass of seawater, the sea ice will always melt.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 SA_seaicearraylike
Absolute Salinity of sea ice: the mass fraction of salt in sea ice, expressed in g of salt per kg of sea ice.
 t_seaicearraylike
Insitu temperature of the sea ice at pressure p (ITS90), degrees C
 Returns
 melting_seaice_SA_CT_ratioarraylike, g/(kg K)
the ratio dSA/dCT of SA to CT changes when sea ice melts into a large mass of seawater

gsw.
melting_seaice_equilibrium_SA_CT_ratio
(SA, p)[source]¶ Calculates the ratio of SA to CT changes when sea ice melts into seawater with both the seawater and the sea ice temperatures being almost equal to the equilibrium freezing temperature. It is assumed that a small mass of seaice melts into an infinite mass of seawater. If indeed the temperature of the seawater and the sea ice were both equal to the freezing temperature, then no melting or freezing would occur; an imbalance between these three temperatures is needed for freezing or melting to occur (the three temperatures being (1) the seawater temperature, (2) the sea ice temperature, and (3) the freezing temperature.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 melting_seaice_equilibrium_SA_CT_ratioarraylike, g/(kg K)
the ratio dSA/dCT of SA to CT changes when sea ice melts into seawater, with the seawater and sea ice being close to the freezing temperature.

gsw.
melting_seaice_equilibrium_SA_CT_ratio_poly
(SA, p)[source]¶ Calculates the ratio of SA to CT changes when sea ice melts into seawater with both the seawater and the sea ice temperatures being almost equal to the equilibrium freezing temperature. It is assumed that a small mass of seaice melts into an infinite mass of seawater. If indeed the temperature of the seawater and the sea ice were both equal to the freezing temperature, then no melting or freezing would occur; an imbalance between these three temperatures is needed for freezing or melting to occur (the three temperatures being (1) the seawater temperature, (2) the sea ice temperature, and (3) the freezing temperature.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 melting_seaice_equilibrium_SA_CT_ratioarraylike, g/(kg K)
the ratio dSA/dCT of SA to CT changes when sea ice melts into seawater, with the seawater and sea ice being close to the freezing temperature.

gsw.
melting_seaice_into_seawater
(SA, CT, p, w_seaice, SA_seaice, t_seaice)[source]¶ Calculates the Absolute Salinity and Conservative Temperature that results when a given mass of sea ice (or ice) melts and is mixed into a known mass of seawater (whose properties are (SA,CT,p)).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 w_seaicearraylike
mass fraction of ice: the mass of seaice divided by the sum of the masses of seaice and seawater. 0 <= wIh <= 1. unitless.
 SA_seaicearraylike
Absolute Salinity of sea ice: the mass fraction of salt in sea ice, expressed in g of salt per kg of sea ice.
 t_seaicearraylike
Insitu temperature of the sea ice at pressure p (ITS90), degrees C
 Returns
 SA_finalarraylike, g/kg
Absolute Salinity of the mixture of the melted sea ice (or ice) and the orignal seawater
 CT_finalarraylike, deg C
Conservative Temperature of the mixture of the melted sea ice (or ice) and the orignal seawater

gsw.
p_from_z
(z, lat, geo_strf_dyn_height=0, sea_surface_geopotential=0)[source]¶ Calculates sea pressure from height using computationallyefficient 75term expression for density, in terms of SA, CT and p (Roquet et al., 2015). Dynamic height anomaly, geo_strf_dyn_height, if provided, must be computed with its p_ref = 0 (the surface). Also if provided, sea_surface_geopotental is the geopotential at zero sea pressure. This function solves Eqn.(3.32.3) of IOC et al. (2010) iteratively for p.
 Parameters
 zarraylike
Depth, positive up, m
 latarraylike
Latitude, 90 to 90 degrees
 geo_strf_dyn_heightarraylike
 dynamic height anomaly, m^2/s^2
Note that the reference pressure, p_ref, of geo_strf_dyn_height must be zero (0) dbar.
 sea_surface_geopotentialarraylike
geopotential at zero sea pressure, m^2/s^2
 Returns
 parraylike, dbar
sea pressure ( i.e. absolute pressure  10.1325 dbar )

gsw.
pchip_interp
(x, y, xi, axis=0)[source]¶ Interpolate using Piecewise Cubic Hermite Interpolating Polynomial
This is a shapepreserving algorithm; it does not introduce new local extrema. The implementation in C that is wrapped here is largely taken from the scipy implementation, https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.PchipInterpolator.html.
Points outside the range of the interpolation table are filled using the end values in the table. (In contrast, scipy.interpolate.pchip_interpolate() extrapolates using the end polynomials.)
 Parameters
 x, yarraylike
Interpolation table x and y; ndimensional, must be broadcastable to the same dimensions.
 xiarraylike
Onedimensional array of new x values.
 axisint, optional, default is 0
Axis along which xi is taken.
 Returns
 yiarray
Values of y interpolated to xi along the specified axis.

gsw.
pot_enthalpy_from_pt_ice
(pt0_ice)[source]¶ Calculates the potential enthalpy of ice from potential temperature of ice (whose reference sea pressure is zero dbar).
 Parameters
 pt0_icearraylike
Potential temperature of ice (ITS90), degrees C
 Returns
 pot_enthalpy_icearraylike, J/kg
potential enthalpy of ice

gsw.
pot_enthalpy_from_pt_ice_poly
(pt0_ice)[source]¶ Calculates the potential enthalpy of ice from potential temperature of ice (whose reference sea pressure is zero dbar). This is a compuationally efficient polynomial fit to the potential enthalpy of ice.
 Parameters
 pt0_icearraylike
Potential temperature of ice (ITS90), degrees C
 Returns
 pot_enthalpy_icearraylike, J/kg
potential enthalpy of ice

gsw.
pot_enthalpy_ice_freezing
(SA, p)[source]¶ Calculates the potential enthalpy of ice at which seawater freezes.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 pot_enthalpy_ice_freezingarraylike, J/kg
potential enthalpy of ice at freezing of seawater

gsw.
pot_enthalpy_ice_freezing_first_derivatives
(SA, p)[source]¶ Calculates the first derivatives of the potential enthalpy of ice at which seawater freezes, with respect to Absolute Salinity SA and pressure P (in Pa).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 pot_enthalpy_ice_freezing_SAarraylike, K kg/g
the derivative of the potential enthalpy of ice at freezing (ITS90) with respect to Absolute salinity at fixed pressure [ K/(g/kg) ] i.e.
 pot_enthalpy_ice_freezing_Parraylike, K/Pa
the derivative of the potential enthalpy of ice at freezing (ITS90) with respect to pressure (in Pa) at fixed Absolute Salinity

gsw.
pot_enthalpy_ice_freezing_first_derivatives_poly
(SA, p)[source]¶ Calculates the first derivatives of the potential enthalpy of ice Ih at which ice melts into seawater with Absolute Salinity SA and at pressure p. This code uses the comptationally efficient polynomial fit of the freezing potential enthalpy of ice Ih (McDougall et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 pot_enthalpy_ice_freezing_SAarraylike, J/g
the derivative of the potential enthalpy of ice at freezing (ITS90) with respect to Absolute salinity at fixed pressure [ (J/kg)/(g/kg) ] i.e.
 pot_enthalpy_ice_freezing_Parraylike, (J/kg)/Pa
the derivative of the potential enthalpy of ice at freezing (ITS90) with respect to pressure (in Pa) at fixed Absolute Salinity

gsw.
pot_enthalpy_ice_freezing_poly
(SA, p)[source]¶ Calculates the potential enthalpy of ice at which seawater freezes. The error of this fit ranges between 2.5 and 1 J/kg with an rms of 1.07, between SA of 0 and 120 g/kg and p between 0 and 10,000 dbar (the error in the fit is between 0.7 and 0.7 with an rms of 0.3, between SA of 0 and 120 g/kg and p between 0 and 5,000 dbar) when compared with the potential enthalpy calculated from the exact insitu freezing temperature which is found by a NewtonRaphson iteration of the equality of the chemical potentials of water in seawater and in ice. Note that the potential enthalpy at freezing can be found by this exact method using the function gsw_pot_enthalpy_ice_freezing.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 pot_enthalpy_ice_freezingarraylike, J/kg
potential enthalpy of ice at freezing of seawater

gsw.
pot_rho_t_exact
(SA, t, p, p_ref)[source]¶ Calculates potential density of seawater. Note. This function outputs potential density, not potential density anomaly; that is, 1000 kg/m^3 is not subtracted.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 p_refarraylike
Reference pressure, dbar
 Returns
 pot_rho_t_exactarraylike, kg/m^3
potential density (not potential density anomaly)

gsw.
pressure_coefficient_ice
(t, p)[source]¶ Calculates pressure coefficient of ice.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 pressure_coefficient_icearraylike, Pa/K
pressure coefficient of ice

gsw.
pressure_freezing_CT
(SA, CT, saturation_fraction)[source]¶ Calculates the pressure (in dbar) of seawater at the freezing temperature. That is, the output is the pressure at which seawater, with Absolute Salinity SA, Conservative Temperature CT, and with saturation_fraction of dissolved air, freezes. If the input values are such that there is no value of pressure in the range between 0 dbar and 10,000 dbar for which seawater is at the freezing temperature, the output, pressure_freezing, is put equal to NaN.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 saturation_fractionarraylike
Saturation fraction of dissolved air in seawater. (0..1)
 Returns
 pressure_freezingarraylike, dbar
sea pressure at which the seawater freezes ( i.e. absolute pressure  10.1325 dbar )

gsw.
pt0_from_t
(SA, t, p)[source]¶ Calculates potential temperature with reference pressure, p_ref = 0 dbar. The present routine is computationally faster than the more general function “gsw_pt_from_t(SA,t,p,p_ref)” which can be used for any reference pressure value. This subroutine calls “gsw_entropy_part(SA,t,p)”, “gsw_entropy_part_zerop(SA,pt0)” and “gsw_gibbs_pt0_pt0(SA,pt0)”.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 pt0arraylike, deg C
potential temperature with reference sea pressure (p_ref) = 0 dbar.

gsw.
pt0_from_t_ice
(t, p)[source]¶ Calculates potential temperature of ice Ih with a reference pressure of 0 dbar, from insitu temperature, t.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 pt0_icearraylike, deg C
potential temperature of ice Ih with reference pressure of zero dbar (ITS90)

gsw.
pt_first_derivatives
(SA, CT)[source]¶ Calculates the following two partial derivatives of potential temperature (the regular potential temperature whose reference sea pressure is 0 dbar) (1) pt_SA, the derivative with respect to Absolute Salinity at constant Conservative Temperature, and (2) pt_CT, the derivative with respect to Conservative Temperature at constant Absolute Salinity.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 Returns
 pt_SAarraylike, K/(g/kg)
The derivative of potential temperature with respect to Absolute Salinity at constant Conservative Temperature.
 pt_CTarraylike, unitless
The derivative of potential temperature with respect to Conservative Temperature at constant Absolute Salinity. pt_CT is dimensionless.

gsw.
pt_from_CT
(SA, CT)[source]¶ Calculates potential temperature (with a reference sea pressure of zero dbar) from Conservative Temperature. This function uses 1.5 iterations through a modified NewtonRaphson (NR) iterative solution proceedure, starting from a rationalfunctionbased initial condition for both pt and dCT_dpt.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 Returns
 ptarraylike, deg C
potential temperature referenced to a sea pressure of zero dbar (ITS90)

gsw.
pt_from_entropy
(SA, entropy)[source]¶ Calculates potential temperature with reference pressure p_ref = 0 dbar and with entropy as an input variable.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 entropyarraylike
Specific entropy, J/(kg*K)
 Returns
 ptarraylike, deg C
potential temperature with reference sea pressure (p_ref) = 0 dbar.

gsw.
pt_from_pot_enthalpy_ice
(pot_enthalpy_ice)[source]¶ Calculates the potential temperature of ice from the potential enthalpy of ice. The reference sea pressure of both the potential temperature and the potential enthalpy is zero dbar.
 Parameters
 pot_enthalpy_icearraylike
Potential enthalpy of ice, J/kg
 Returns
 pt0_icearraylike, deg C
potential temperature of ice (ITS90)

gsw.
pt_from_pot_enthalpy_ice_poly
(pot_enthalpy_ice)[source]¶ Calculates the potential temperature of ice (whose reference sea pressure is zero dbar) from the potential enthalpy of ice. This is a compuationally efficient polynomial fit to the potential enthalpy of ice.
 Parameters
 pot_enthalpy_icearraylike
Potential enthalpy of ice, J/kg
 Returns
 pt0_icearraylike, deg C
potential temperature of ice (ITS90)

gsw.
pt_from_t
(SA, t, p, p_ref)[source]¶ Calculates potential temperature with the general reference pressure, p_ref, from insitu temperature, t. This function calls “gsw_entropy_part” which evaluates entropy except for the parts which are a function of Absolute Salinity alone. A faster gsw routine exists if p_ref is indeed zero dbar. This routine is “gsw_pt0_from_t(SA,t,p)”.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 p_refarraylike
Reference pressure, dbar
 Returns
 ptarraylike, deg C
potential temperature with reference pressure, p_ref, on the ITS90 temperature scale

gsw.
pt_from_t_ice
(t, p, p_ref)[source]¶ Calculates potential temperature of ice Ih with the general reference pressure, p_ref, from insitu temperature, t.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 p_refarraylike
Reference pressure, dbar
 Returns
 pt_icearraylike, deg C
potential temperature of ice Ih with reference pressure, p_ref, on the ITS90 temperature scale

gsw.
pt_second_derivatives
(SA, CT)[source]¶ Calculates the following three secondorder derivatives of potential temperature (the regular potential temperature which has a reference sea pressure of 0 dbar), (1) pt_SA_SA, the second derivative with respect to Absolute Salinity at constant Conservative Temperature, (2) pt_SA_CT, the derivative with respect to Conservative Temperature and Absolute Salinity, and (3) pt_CT_CT, the second derivative with respect to Conservative Temperature at constant Absolute Salinity.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 Returns
 pt_SA_SAarraylike, K/((g/kg)^2)
The second derivative of potential temperature (the regular potential temperature which has reference sea pressure of 0 dbar) with respect to Absolute Salinity at constant Conservative Temperature.
 pt_SA_CTarraylike, 1/(g/kg)
The derivative of potential temperature with respect to Absolute Salinity and Conservative Temperature.
 pt_CT_CTarraylike, 1/K
The second derivative of potential temperature (the regular one with p_ref = 0 dbar) with respect to Conservative Temperature at constant SA.

gsw.
rho
(SA, CT, p)[source]¶ Calculates insitu density from Absolute Salinity and Conservative Temperature, using the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 rhoarraylike, kg/m
insitu density

gsw.
rho_alpha_beta
(SA, CT, p)[source]¶ Calculates insitu density, the appropiate thermal expansion coefficient and the appropriate saline contraction coefficient of seawater from Absolute Salinity and Conservative Temperature. This function uses the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 rhoarraylike, kg/m
insitu density
 alphaarraylike, 1/K
thermal expansion coefficient with respect to Conservative Temperature
 betaarraylike, kg/g
saline (i.e. haline) contraction coefficient at constant Conservative Temperature

gsw.
rho_first_derivatives
(SA, CT, p)[source]¶ Calculates the three (3) partial derivatives of insitu density with respect to Absolute Salinity, Conservative Temperature and pressure. Note that the pressure derivative is done with respect to pressure in Pa, not dbar. This function uses the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 rho_SAarraylike, (kg/m^3)(g/kg)^1
partial derivative of density with respect to Absolute Salinity
 rho_CTarraylike, kg/(m^3 K)
partial derivative of density with respect to Conservative Temperature
 rho_Parraylike, kg/(m^3 Pa)
partial derivative of density with respect to pressure in Pa

gsw.
rho_first_derivatives_wrt_enthalpy
(SA, CT, p)[source]¶ Calculates the following two firstorder derivatives of specific volume (v), (1) rho_SA, firstorder derivative with respect to Absolute Salinity at constant CT & p. (2) rho_h, firstorder derivative with respect to SA & CT at constant p.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 rho_SAarraylike, J/(kg (g/kg)^2)
The first derivative of rho with respect to Absolute Salinity at constant CT & p.
 rho_harraylike, J/(kg K(g/kg))
The first derivative of rho with respect to SA and CT at constant p.

gsw.
rho_ice
(t, p)[source]¶ Calculates insitu density of ice from insitu temperature and pressure. Note that the output, rho_ice, is density, not density anomaly; that is, 1000 kg/m^3 is not subracted from it.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 rho_icearraylike, kg/m^3
insitu density of ice (not density anomaly)

gsw.
rho_second_derivatives
(SA, CT, p)[source]¶ Calculates the following five secondorder derivatives of rho, (1) rho_SA_SA, secondorder derivative with respect to Absolute Salinity at constant CT & p. (2) rho_SA_CT, secondorder derivative with respect to SA & CT at constant p. (3) rho_CT_CT, secondorder derivative with respect to CT at constant SA & p. (4) rho_SA_P, secondorder derivative with respect to SA & P at constant CT. (5) rho_CT_P, secondorder derivative with respect to CT & P at constant SA.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 rho_SA_SAarraylike, (kg/m^3)(g/kg)^2
The secondorder derivative of rho with respect to Absolute Salinity at constant CT & p.
 rho_SA_CTarraylike, (kg/m^3)(g/kg)^1 K^1
The secondorder derivative of rho with respect to SA and CT at constant p.
 rho_CT_CTarraylike, (kg/m^3) K^2
The secondorder derivative of rho with respect to CT at constant SA & p
 rho_SA_Parraylike, (kg/m^3)(g/kg)^1 Pa^1
The secondorder derivative with respect to SA & P at constant CT.
 rho_CT_Parraylike, (kg/m^3) K^1 Pa^1
The secondorder derivative with respect to CT & P at constant SA.

gsw.
rho_second_derivatives_wrt_enthalpy
(SA, CT, p)[source]¶ Calculates the following three secondorder derivatives of rho with respect to enthalpy, (1) rho_SA_SA, secondorder derivative with respect to Absolute Salinity at constant h & p. (2) rho_SA_h, secondorder derivative with respect to SA & h at constant p. (3) rho_h_h, secondorder derivative with respect to h at constant SA & p.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 rho_SA_SAarraylike, J/(kg (g/kg)^2)
The secondorder derivative of rho with respect to Absolute Salinity at constant h & p.
 rho_SA_harraylike, J/(kg K(g/kg))
The secondorder derivative of rho with respect to SA and h at constant p.
 rho_h_harraylike,
The secondorder derivative of rho with respect to h at constant SA & p

gsw.
rho_t_exact
(SA, t, p)[source]¶ Calculates insitu density of seawater from Absolute Salinity and insitu temperature. Note that the output, rho, is density, not density anomaly; that is, 1000 kg/m^3 is not subracted from it.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 rho_t_exactarraylike, kg/m^3
insitu density (not density anomaly)

gsw.
seaice_fraction_to_freeze_seawater
(SA, CT, p, SA_seaice, t_seaice)[source]¶ Calculates the mass fraction of sea ice (mass of sea ice divided by mass of sea ice plus seawater), which, when melted into seawater having the properties (SA,CT,p) causes the final seawater to be at the freezing temperature. The other outputs are the Absolute Salinity and Conservative Temperature of the final seawater.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 SA_seaicearraylike
Absolute Salinity of sea ice: the mass fraction of salt in sea ice, expressed in g of salt per kg of sea ice.
 t_seaicearraylike
Insitu temperature of the sea ice at pressure p (ITS90), degrees C
 Returns
 SA_freezearraylike, g/kg
Absolute Salinity of seawater after the mass fraction of sea ice, w_seaice, at temperature t_seaice has melted into the original seawater, and the final mixture is at the freezing temperature of seawater.
 CT_freezearraylike, deg C
Conservative Temperature of seawater after the mass fraction, w_seaice, of sea ice at temperature t_seaice has melted into the original seawater, and the final mixture is at the freezing temperature of seawater.
 w_seaicearraylike, unitless
mass fraction of sea ice, at SA_seaice and t_seaice, which, when melted into seawater at (SA,CT,p) leads to the final mixed seawater being at the freezing temperature. This output is between 0 and 1.

gsw.
sigma0
(SA, CT)[source]¶ Calculates potential density anomaly with reference pressure of 0 dbar, this being this particular potential density minus 1000 kg/m^3. This function has inputs of Absolute Salinity and Conservative Temperature. This function uses the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 Returns
 sigma0arraylike, kg/m^3
potential density anomaly with respect to a reference pressure of 0 dbar, that is, this potential density  1000 kg/m^3.

gsw.
sigma1
(SA, CT)[source]¶ Calculates potential density anomaly with reference pressure of 1000 dbar, this being this particular potential density minus 1000 kg/m^3. This function has inputs of Absolute Salinity and Conservative Temperature. This function uses the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 Returns
 sigma1arraylike, kg/m^3
potential density anomaly with respect to a reference pressure of 1000 dbar, that is, this potential density  1000 kg/m^3.

gsw.
sigma2
(SA, CT)[source]¶ Calculates potential density anomaly with reference pressure of 2000 dbar, this being this particular potential density minus 1000 kg/m^3. Temperature. This function uses the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 Returns
 sigma2arraylike, kg/m^3
potential density anomaly with respect to a reference pressure of 2000 dbar, that is, this potential density  1000 kg/m^3.

gsw.
sigma3
(SA, CT)[source]¶ Calculates potential density anomaly with reference pressure of 3000 dbar, this being this particular potential density minus 1000 kg/m^3. Temperature. This function uses the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 Returns
 sigma3arraylike, kg/m^3
potential density anomaly with respect to a reference pressure of 3000 dbar, that is, this potential density  1000 kg/m^3.

gsw.
sigma4
(SA, CT)[source]¶ Calculates potential density anomaly with reference pressure of 4000 dbar, this being this particular potential density minus 1000 kg/m^3. Temperature. This function uses the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 Returns
 sigma4arraylike, kg/m^3
potential density anomaly with respect to a reference pressure of 4000 dbar, that is, this potential density  1000 kg/m^3.

gsw.
sound_speed
(SA, CT, p)[source]¶ Calculates the speed of sound in seawater. This function has inputs of Absolute Salinity and Conservative Temperature. This function uses the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 sound_speedarraylike, m/s
speed of sound in seawater

gsw.
sound_speed_ice
(t, p)[source]¶ Calculates the compression speed of sound in ice.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 sound_speed_icearraylike, m/s
compression speed of sound in ice

gsw.
sound_speed_t_exact
(SA, t, p)[source]¶ Calculates the speed of sound in seawater.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 sound_speed_t_exactarraylike, m/s
speed of sound in seawater

gsw.
specvol
(SA, CT, p)[source]¶ Calculates specific volume from Absolute Salinity, Conservative Temperature and pressure, using the computationallyefficient 75term polynomial expression for specific volume (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 specvolarraylike, m^3/kg
specific volume

gsw.
specvol_alpha_beta
(SA, CT, p)[source]¶ Calculates specific volume, the appropiate thermal expansion coefficient and the appropriate saline contraction coefficient of seawater from Absolute Salinity and Conservative Temperature. This function uses the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 specvolarraylike, m/kg
specific volume
 alphaarraylike, 1/K
thermal expansion coefficient with respect to Conservative Temperature
 betaarraylike, kg/g
saline (i.e. haline) contraction coefficient at constant Conservative Temperature

gsw.
specvol_anom_standard
(SA, CT, p)[source]¶ Calculates specific volume anomaly from Absolute Salinity, Conservative Temperature and pressure. It uses the computationallyefficient expression for specific volume as a function of SA, CT and p (Roquet et al., 2015). The reference value to which the anomally is calculated has an Absolute Salinity of SSO and Conservative Temperature equal to 0 degress C.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 specvol_anomarraylike, m^3/kg
specific volume anomaly

gsw.
specvol_first_derivatives
(SA, CT, p)[source]¶ Calculates the following three firstorder derivatives of specific volume (v), (1) v_SA, firstorder derivative with respect to Absolute Salinity at constant CT & p. (2) v_CT, firstorder derivative with respect to CT at constant SA & p. (3) v_P, firstorder derivative with respect to P at constant SA and CT.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 v_SAarraylike, (m^3/kg)(g/kg)^1
The first derivative of specific volume with respect to Absolute Salinity at constant CT & p.
 v_CTarraylike, m^3/(K kg)
The first derivative of specific volume with respect to CT at constant SA and p.
 v_Parraylike, m^3/(Pa kg)
The first derivative of specific volume with respect to P at constant SA and CT.

gsw.
specvol_first_derivatives_wrt_enthalpy
(SA, CT, p)[source]¶ Calculates the following two firstorder derivatives of specific volume (v), (1) v_SA_wrt_h, firstorder derivative with respect to Absolute Salinity at constant h & p. (2) v_h, firstorder derivative with respect to h at constant SA & p.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 v_SA_wrt_harraylike, (m^3/kg)(g/kg)^1 (J/kg)^1
The first derivative of specific volume with respect to Absolute Salinity at constant CT & p.
 v_harraylike, (m^3/kg)(J/kg)^1
The first derivative of specific volume with respect to SA and CT at constant p.

gsw.
specvol_ice
(t, p)[source]¶ Calculates the specific volume of ice.
 Parameters
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 specvol_icearraylike, m^3/kg
specific volume

gsw.
specvol_second_derivatives
(SA, CT, p)[source]¶ Calculates the following five secondorder derivatives of specific volume (v), (1) v_SA_SA, secondorder derivative with respect to Absolute Salinity at constant CT & p. (2) v_SA_CT, secondorder derivative with respect to SA & CT at constant p. (3) v_CT_CT, secondorder derivative with respect to CT at constant SA and p. (4) v_SA_P, secondorder derivative with respect to SA & P at constant CT. (5) v_CT_P, secondorder derivative with respect to CT & P at constant SA.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 v_SA_SAarraylike, (m^3/kg)(g/kg)^2
The second derivative of specific volume with respect to Absolute Salinity at constant CT & p.
 v_SA_CTarraylike, (m^3/kg)(g/kg)^1 K^1
The second derivative of specific volume with respect to SA and CT at constant p.
 v_CT_CTarraylike, (m^3/kg) K^2)
The second derivative of specific volume with respect to CT at constant SA and p.
 v_SA_Parraylike, (m^3/kg) Pa^1
The second derivative of specific volume with respect to SA and P at constant CT.
 v_CT_Parraylike, (m^3/kg) K^1 Pa^1
The second derivative of specific volume with respect to CT and P at constant SA.

gsw.
specvol_second_derivatives_wrt_enthalpy
(SA, CT, p)[source]¶ Calculates the following three firstorder derivatives of specific volume (v) with respect to enthalpy, (1) v_SA_SA_wrt_h, secondorder derivative with respect to Absolute Salinity at constant h & p. (2) v_SA_h, secondorder derivative with respect to SA & h at constant p. (3) v_h_h, secondorder derivative with respect to h at constant SA & p.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 v_SA_SA_wrt_harraylike, (m^3/kg)(g/kg)^2 (J/kg)^1
The secondorder derivative of specific volume with respect to Absolute Salinity at constant h & p.
 v_SA_harraylike, (m^3/kg)(g/kg)^1 (J/kg)^1
The secondorder derivative of specific volume with respect to SA and h at constant p.
 v_h_harraylike, (m^3/kg)(J/kg)^2
The secondorder derivative with respect to h at constant SA & p.

gsw.
specvol_t_exact
(SA, t, p)[source]¶ Calculates the specific volume of seawater.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 specvol_t_exactarraylike, m^3/kg
specific volume

gsw.
spiciness0
(SA, CT)[source]¶ Calculates spiciness from Absolute Salinity and Conservative Temperature at a pressure of 0 dbar, as described by McDougall and Krzysik (2015). This routine is based on the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 Returns
 spiciness0arraylike, kg/m^3
spiciness referenced to a pressure of 0 dbar, i.e. the surface

gsw.
spiciness1
(SA, CT)[source]¶ Calculates spiciness from Absolute Salinity and Conservative Temperature at a pressure of 1000 dbar, as described by McDougall and Krzysik (2015). This routine is based on the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 Returns
 spiciness1arraylike, kg/m^3
spiciness referenced to a pressure of 1000 dbar

gsw.
spiciness2
(SA, CT)[source]¶ Calculates spiciness from Absolute Salinity and Conservative Temperature at a pressure of 2000 dbar, as described by McDougall and Krzysik (2015). This routine is based on the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 Returns
 spiciness2arraylike, kg/m^3
spiciness referenced to a pressure of 2000 dbar

gsw.
t90_from_t68
(t68)[source]¶ ITS90 temperature from IPTS68 temperature
This conversion should be applied to all insitu data collected between 1/1/1968 and 31/12/1989.

gsw.
t_deriv_chem_potential_water_t_exact
(SA, t, p)[source]¶ Calculates the temperature derivative of the chemical potential of water in seawater so that it is valid at exactly SA = 0.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 tarraylike
Insitu temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 chem_potential_water_dtarraylike, J g^1 K^1
temperature derivative of the chemical potential of water in seawater

gsw.
t_freezing
(SA, p, saturation_fraction)[source]¶ Calculates the insitu temperature at which seawater freezes. The insitu temperature freezing point is calculated from the exact insitu freezing temperature which is found by a modified NewtonRaphson iteration (McDougall and Wotherspoon, 2013) of the equality of the chemical potentials of water in seawater and in ice.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 saturation_fractionarraylike
Saturation fraction of dissolved air in seawater. (0..1)
 Returns
 t_freezingarraylike, deg C
insitu temperature at which seawater freezes. (ITS90)

gsw.
t_freezing_first_derivatives
(SA, p, saturation_fraction)[source]¶ Calculates the first derivatives of the insitu temperature at which seawater freezes with respect to Absolute Salinity SA and pressure P (in Pa). These expressions come from differentiating the expression that defines the freezing temperature, namely the equality between the chemical potentials of water in seawater and in ice.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 saturation_fractionarraylike
Saturation fraction of dissolved air in seawater. (0..1)
 Returns
 tfreezing_SAarraylike, K kg/g
the derivative of the insitu freezing temperature (ITS90) with respect to Absolute Salinity at fixed pressure [ K/(g/kg) ] i.e.
 tfreezing_Parraylike, K/Pa
the derivative of the insitu freezing temperature (ITS90) with respect to pressure (in Pa) at fixed Absolute Salinity

gsw.
t_freezing_first_derivatives_poly
(SA, p, saturation_fraction)[source]¶ Calculates the frist derivatives of the insitu temperature at which seawater freezes with respect to Absolute Salinity SA and pressure P (in Pa). These expressions come from differentiating the expression that defines the freezing temperature, namely the equality between the chemical potentials of water in seawater and in ice.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 saturation_fractionarraylike
Saturation fraction of dissolved air in seawater. (0..1)
 Returns
 tfreezing_SAarraylike, K kg/g
the derivative of the insitu freezing temperature (ITS90) with respect to Absolute Salinity at fixed pressure [ K/(g/kg) ] i.e.
 tfreezing_Parraylike, K/Pa
the derivative of the insitu freezing temperature (ITS90) with respect to pressure (in Pa) at fixed Absolute Salinity

gsw.
t_freezing_poly
(SA, p, saturation_fraction)[source]¶ Calculates the insitu temperature at which seawater freezes from a comptationally efficient polynomial.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 saturation_fractionarraylike
Saturation fraction of dissolved air in seawater. (0..1)
 Returns
 t_freezingarraylike, deg C
insitu temperature at which seawater freezes. (ITS90)

gsw.
t_from_CT
(SA, CT, p)[source]¶ Calculates insitu temperature from the Conservative Temperature of seawater.
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 tarraylike, deg C
insitu temperature (ITS90)

gsw.
t_from_pt0_ice
(pt0_ice, p)[source]¶ Calculates insitu temperature from the potential temperature of ice Ih with reference pressure, p_ref, of 0 dbar (the surface), and the insitu pressure.
 Parameters
 pt0_icearraylike
Potential temperature of ice (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 tarraylike, deg C
insitu temperature (ITS90)

gsw.
thermobaric
(SA, CT, p)[source]¶ Calculates the thermobaric coefficient of seawater with respect to Conservative Temperature. This routine is based on the computationallyefficient expression for specific volume in terms of SA, CT and p (Roquet et al., 2015).
 Parameters
 SAarraylike
Absolute Salinity, g/kg
 CTarraylike
Conservative Temperature (ITS90), degrees C
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 Returns
 thermobaricarraylike, 1/(K Pa)
thermobaric coefficient with respect to Conservative Temperature.

gsw.
z_from_p
(p, lat, geo_strf_dyn_height=0, sea_surface_geopotential=0)[source]¶ Calculates height from sea pressure using the computationallyefficient 75term expression for specific volume in terms of SA, CT and p (Roquet et al., 2015). Dynamic height anomaly, geo_strf_dyn_height, if provided, must be computed with its p_ref = 0 (the surface). Also if provided, sea_surface_geopotental is the geopotential at zero sea pressure. This function solves Eqn.(3.32.3) of IOC et al. (2010).
 Parameters
 parraylike
Sea pressure (absolute pressure minus 10.1325 dbar), dbar
 latarraylike
Latitude, 90 to 90 degrees
 geo_strf_dyn_heightarraylike
 dynamic height anomaly, m^2/s^2
Note that the reference pressure, p_ref, of geo_strf_dyn_height must be zero (0) dbar.
 sea_surface_geopotentialarraylike
geopotential at zero sea pressure, m^2/s^2
 Returns
 zarraylike, m
height