Skip to content

dev. Docstring Syntax Sample Function

Kai Mühlbauer edited this page Feb 23, 2018 · 1 revision

Syntax

Every function or class in wradlib need to have a docstring. Below you can find a sample_function with an example docstring. Be sure additions follow this example.

def sample_function(arg1, arg2, arg3=12, arg4='silent'):
    """Sample Summary Line

    This is a sample function which has positional arguments ``arg1`` and
    ``arg2`` as well as keyword arguments ``arg3`` and ``arg4``.

    Parameters
    ----------
    arg1 : :class:`numpy:numpy.ndarray`
        Array of some useful values.
    arg2 : float
        Some extreme useful floating point value.
    arg3 : int
        Number of some events. Defaults to 12.
    arg4 : str
        Some string used for events. Defaults to 'silent'.

    See Also
    --------
    :func:`~wradlib.module.other_function`
    :class:`~wradlib.module.OtherClass`

    Note
    ----
    Here we can explain some important aspects.

    Warning
    -------
    Here we explain things users need to know. 

    Examples
    --------
    Here we give some links to examples or we setup as 
    doctest

    >>> from wradlib.sample_module import sample_function
    >>> result = sample_function(a1, a2)
    >>> print(result)
    just a string
    """