def calc_absorption(_SystemFrequency_, _SpeedOfSound_, _Salinity_, _Temperature_, _XdcrDepth_):
    """
    Calculate the water absorption.
    :param _SystemFrequency_: System frequency
    :param _SpeedOfSound_:  Speed of Sound m/s
    :param _Salinity_: Salinity in ppt.
    :param _Temperature_: Water Temperature in C
    :param _XdcrDepth_: Transducer Depth in m.
    :return: Water Absorption.
    """

    if _SpeedOfSound_ == 0 or _Salinity_ == 0 or _SystemFrequency_ == 0:
        return 0

    pH = 8.0
    P1 = 1.0

    # Frequency
    freq = _SystemFrequency_ / 1000.0

    # A1
    # dB Km^-1 KHz^-1
    A1 = 8.68 / _SpeedOfSound_ * 10.0 ** (0.78 * pH - 5.0)

    # f1
    f1 = 2.8 * ((_Salinity_ / 35.0) ** 0.5) * (10.0 ** (4.0 - 1245.0 / (273.0 + _Temperature_)))

    # A2
    #  dB km^-1 kHz^-1
    A2 = 21.44 * _Salinity_ / _SpeedOfSound_ * (1.0 + 0.025 * _Temperature_)

    # P2
    P2 = 1.0 - 1.37 * (10.0 ** (-4.0)) * _XdcrDepth_ + 6.2 * (10.0 ** (-9.0)) * (_XdcrDepth_ ** 2)

    # f2
    # kHz
    f2 = 8.17 * (10.0 ** (8.0 - 1990.0 / (273.0 + _Temperature_))) / (1.0 + 0.0018 * (_Salinity_ - 35.0))

    # A3
    A3 = 4.93 * (10.0 ** (-4.0)) - 2.59 * (10.0 ** (-5.0)) * _Temperature_ + 9.11 * (10.0 ** (-7.0)) * (_Temperature_ ** 2.0)

    # P3
    P3 = 1.0 - 3.83 * (10.0 ** (-5.0)) * _XdcrDepth_ + 4.9 * (10.0 ** (-10.0)) * (_XdcrDepth_ ** 2.0)

    # Boric Acid Relaxation
    bar = A1 * P1 * f1 * (freq ** 2.0) / ((freq ** 2.0) + (f1 ** 2.0)) / 1000.0

    # MgSO3 Magnesium Sulphate Relaxation
    msr = A2 * P2 * f2 * (freq ** 2.0) / ((freq ** 2.0) + (f2 ** 2.0)) / 1000.0

    # Freshwater Attenuation
    fa = A3 * P3 * (freq ** 2.0) / 1000.0

    # Absorption
    return bar + msr + fa