def dynamic_enthalpy_CT_exact(SA, CT, p):
    r"""Calculates the dynamic enthalpy of seawater from Absolute Salinity and
    Conservative Temperature and pressure.  Dynamic enthalpy is defined as
    enthalpy minus potential enthalpy (Young, 2010).

    Parameters
    ----------
    SA : array_like
         Absolute Salinity  [g/kg]
    CT : array_like
         Conservative Temperature [:math:`^\circ` C (ITS-90)]
    p : array_like
        sea pressure [dbar]

    Returns
    -------
    dynamic_enthalpy_CT_exact : array_like
                                dynamic enthalpy [J/kg]

    See Also
    --------
    TODO

    Notes
    -----
    This function uses the full Gibbs function.  There is an alternative to
    calling this function, namely dynamic_enthalpy(SA, CT, p), which uses the
    computationally efficient 48-term expression for density in terms of SA, CT
    and p (McDougall et al., 2011).

    Examples
    --------
    TODO

    References
    ----------
    .. [1] IOC, SCOR and IAPSO, 2010: The international thermodynamic equation
    of seawater - 2010: Calculation and use of thermodynamic properties.
    Intergovernmental Oceanographic Commission, Manuals and Guides No. 56,
    UNESCO (English), 196 pp. See apendix A.30.

    .. [2] McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2011:  A
    computationally efficient 48-term expression for the density of
    seawater in terms of Conservative Temperature, and related properties
    of seawater.

    .. [3] Young, W.R., 2010: Dynamic enthalpy, Conservative Temperature, and
    the seawater Boussinesq approximation. Journal of Physical Oceanography,
    40, 394-400.

    Modifications:
    2011-04-05. Trevor McDougall and Paul Barker.
    """

    t = t_from_CT(SA, CT, p)
    return enthalpy_t_exact(SA, t, p) - cp0 * CT
def enthalpy_diff_CT_exact(SA, CT, p_shallow, p_deep):
    r"""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.  The output
    (enthalpy_diff_CT_exact) is the specific enthalpy evaluated at
    (SA, CT, p_deep) minus the specific enthalpy at (SA,CT,p_shallow).

    parameters
    ----------
    Parameters
    ----------
    SA : array_like
         Absolute Salinity  [g/kg]
    CT : array_like
         Conservative Temperature [:math:`^\circ` C (ITS-90)]
    p_shallow : array_like
                lower sea pressure [dbar]
    p_deep : array-like
             upper sea pressure [dbar]

    returns
    -------
    enthalpy_diff_CT_exact : array_like
                             difference of specific enthalpy [J/kg]
                             (deep minus shallow)

    See Also
    --------
    TODO

    Notes
    -----
    This function uses the full Gibbs function.  There is an alternative to
    calling this function, namely enthalpy_diff_CT(SA, CT, p), which uses the
    computationally efficient 48-term expression for density in terms of SA, CT
    and p (McDougall et al., 2011).

    Examples
    --------
    TODO

    References
    ----------
    .. [1] IOC, SCOR and IAPSO, 2010: The international thermodynamic equation
    of seawater - 2010: Calculation and use of thermodynamic properties.
    Intergovernmental Oceanographic Commission, Manuals and Guides No. 56,
    UNESCO (English), 196 pp. See Eqns (3.32.2).

    .. [2] McDougall T.J., P.M. Barker, R. Feistel and D.R. Jackett, 2011:  A
    computationally efficient 48-term expression for the density of
    seawater in terms of Conservative Temperature, and related properties
    of seawater.

    Modifications:
    2011-04-06. Trevor McDougall and Paul Barker.
    """

    t_shallow = t_from_CT(SA, CT, p_shallow)
    t_deep = t_from_CT(SA, CT, p_deep)
    return (enthalpy_t_exact(SA, t_deep, p_deep) -
            enthalpy_t_exact(SA, t_shallow, p_shallow))