hugocruzz / PyLake

This package present methods used to compute meaningful physical properties in aquatic physics.
8 stars 6 forks source link

Wrong return parametrs in the documentation for buoyancy_freq #2

Closed bhlevca closed 3 months ago

bhlevca commented 4 months ago

The definition of the function is:

def buoyancy_freq(Temp, depth=None, g=9.81):
    '''
    Description: Calculate the buoyancy frequency (Brunt-Vaisala frequency) for a temperature profile.

    Parameters
    ----------- 
    Temp: array_like
        A numeric vector of water temperature in degrees C
    depth: array_like
        a numeric vector corresponding to the depth (in m) of the Temp measurements
    g: scalar, default: 9.81
        gravity acceleration (m/s2)

    Returns
    ----------
    n2: array_like
        a vector of buoyancy frequency in units \code{sec^-2}.
    n2depth: array_like
        Return value has attribute "depth" which define buoyancy frequency depth (which differ from supplied depth).

    Example
    ----------
    >>>     wtr = np.array([22.51, 22.42, 22.4, 22.4, 22.4, 22.36, 22.3, 22.21, 22.11, 21.23, 16.42,15.15, 14.24, 13.35, 10.94, 10.43, 10.36, 9.94, 9.45, 9.1, 8.91, 8.58, 8.43])
    ...    depth = np.array([0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])
    ...    avg_depth, buoy_freq = lw.buoyancy_freq(wtr, depth, self.g)
    ...    plt.pcolormesh(buoy_freq)

however, the function returns only one array "n2" return n2

f-baerenbold commented 3 months ago

Yes, you are right. The output depth is actually part of the xarray output: n2["avg_depth"].

I changed the doc accordingly in the repo, that we keep updated: https://github.com/eawag-surface-waters-research/PyLake. It will be pushed to pypi for the next release.

Thanks for letting us know.