def _day2filenum(interval, day):
    """
    Convert a date to corresponding file number.

    Results depend on file interval- weekly, daily, semi-monthly.

    Parameters
    ----------
    interval : string
        The file interval.  Daily, weekly, or semi-monthly accepted,
        represented by lower case first letter.
    day : string
        A number indicating the date.

    Returns
    -------
    filenum : string
        The number of the file within the month of meteorology.
    """
    if interval == 'w':
        filenum = str((int(day) - 1) // 7 + 1)
    elif interval == 's':
        filenum = str((int(day) - 1) // 15 + 1)
    elif interval == 'd' or interval == 'm':
        filenum = day
    else:
        raise ValueError('Meteorology interval not recognized')
    return filenum
