import re


def get_data(radiance_df, year, month, day):
    """Extracts single-day radiance (values or
    cloud mask values) into a dataframe, based on
    the specified date.

    Parameters
    ----------
    radiance_df : pandas dataframe
        Dataframe indexed by pixel ID containing the
        radiance data by date (columns).

    year : str
        Four-digit year (YYYY).

    month : str
        Two-digit month (MM), with leading 0s
        (ex: '01', '02', '03', '10').

    day : str
        Two-digit (MM) month, with leading 0s
        (ex: '01', '02', '03', '10').

    Returns
    -------
    radiance : pandas dataframe
        Dataframe containing the single-day radiance data.

    Example
    -------
        >>> # Define path to radiance data
        >>> psu_radiance_path = os.path.join(
        ...     radiance_directory,
        ...     "PSU_Radiance_RavelOrderF.csv")
        >>> # Read radiance values to dataframe
        >>> psu_radiance_df = pd.read_csv(psu_radiance_path)
        >>> # Get radiance data for September 1, 2019
        >>> radiance_2019_09_01 = get_data(
        ...     psu_radiance_df, year='2019', month='09', day='01')
    """
    # Get single-day radiance data (values or cloud mask) dataframe
    #  that matches the exact date in the input dataframe
    radiance = [radiance_df[[col]]
                for col in radiance_df.columns
                if re.compile(f"^{year}-{month}-{day}$").match(col)][0]

    # Return the single-day radiance dataframe
    return radiance