def rotate2D(data, notation=None):
    """Rotates the coordinates of wind data

    Parameters
    ----------
    data: pandas DataFrame 
        the dataFrame to be rotated
    notation: notation object
        a notation object to know which are the wind variables

    Returns
    -------
    pandas.DataFrame
        the complete data input with the wind components rotated
    """
    from math import atan2, sqrt
    import numpy as np
    from .. import algs
    defs = algs.get_notation(notation)
    wind_vars = [defs.u, defs.v, defs.w]
    wind_vec = data[wind_vars].mean().values
    m_u, m_v, m_w = wind_vec
    alpha = atan2(m_v, m_u)
    beta = -atan2(m_w, sqrt(m_u ** 2.0 + m_v ** 2.0))
    DC = np.zeros((3, 3))
    DC[0, 0], DC[0, 1], DC[0, 2] = np.cos(alpha) * np.cos(beta), np.cos(beta
        ) * np.sin(alpha), -np.sin(beta)
    DC[1, 0], DC[1, 1], DC[1, 2] = -np.sin(alpha), np.cos(alpha), 0.0
    DC[2, 0], DC[2, 1], DC[2, 2] = np.cos(alpha) * np.sin(beta), np.sin(alpha
        ) * np.sin(beta), np.cos(beta)
    data[wind_vars] = np.dot(DC, data[wind_vars].values.T).T
    return data
